here i am trying add (EA) in every record for column 1 is it possible to save value in column 1 like 1.0 Each(EA) followed by 0.0 / 0.001 (EA)...
df_1
Out[46]:
0 1
0 Unit of Measure Each (EA)
1 Conversion 1.0 Each
2 Net/Gross Weight (lbs) 0.0 / 0.001
3 Volume (cubic ft) 0.0
4 Shipping Dimensions (inch) L x W x H 0.589 x 0.589 x 0.589
5 GTIN NaN
Use:
df['1'].apply(lambda x: str(x) + '(EA)' if '(EA)' not in str(x) else x)
if the name of column not is a str
then use:
df[1].apply(lambda x: str(x) + '(EA)' if '(EA)' not in str(x) else x)
Try this
df['1']=df['1']+ '(EA)'
It will add (EA) to every row except for the row that has NaN
df_1['1'] = df_1['1'] + " (EA)"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.