Jul-20-2021, 06:54 PM
This is my Qtable/Qlist info on datatypes:
Am expecting csv output to be below:
Data columns (total 5 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Col1 5 non-null object 1 Col2 5 non-null object 2 Col3 5 non-null object 3 Col3 5 non-null object 4 Col4 5 non-null int16 dtypes: int16(1), object(4)I thought using lambda will help to decode only the object columns which is in bytes as I have 1 int as datatypes.
df = df.apply(lambda x: x.decode() if isinstance(x, bytes) else x) df.to_csv (r'PATH/Out.csv',index = False, header=True)Right now, my output is below on CSV:
Col1,Col2,Col3,Col3,Col4 [''],[b'abcdfe'],[b'ABC'],[b''],0 [''],[b'hijkl'],[b'LMNDE'],[b''],0 [''],[b'mno'],[b'YUTER'],[b''],0I want to convert the bytes column to normal col and then write it to csv.
Am expecting csv output to be below:
Col1,Col2,Col3,Col3,Col4 ,abcdfe,ABC,,0 ,hijkl',LMNDE',,0 ,mno',YUTER',,0