Код: Выделить всё
df['Height'] = df['Height'].str.replace("'", ' Feet ').str[:-1] + " Inches"Код: Выделить всё
if Height field value length = 15 then replace add "0" in the 8th position else do nothing to the valueКод: Выделить всё
df['Height'] = np.where(df.Height.str.len() == 15, df.Height, df.Height[:8] + '0' + df.Height[8:])
No change
Код: Выделить всё
df['Height'] = np.where(df['Height'].str.len() == 15, df.apply(lambda x: x['Height'][:8]+'0'+x['Height'][8:], axis=1), df['Height'])
TypeError: 'float' object is not subscriptable
Код: Выделить всё
df['Height'] = np.where(df['Height'].str.len() == 15, df['Height'], df['Height'][:8] + '0' + df['Height'][8:])
No change
Мобильная версия