I have a dataframe in a data file:
test_num|minval|maxval|test_name|unit|pin|condit
5|-0.0015|0.0015|Uoffset|V|1|Ucc=Uee=15V
6|-0.0015|0.0015|Uoffset|V|1|Ucc=Uee=15V
7|-0.0015|0.0015|Uoffset|V|2|Ucc=Uee=15V
8|-0.0015|0.0015|Uoffset|V|2|Ucc=Uee=15V
When the data is read, the column 'unit' becomes floating point:
info=pd.read_csv('pdinfo.dat',sep='|',index_col='test_num')
print(info)
5 -1.500000e-03 1.500000e-03 Uoffset V 1.0 Ucc=Uee=15V
6 -1.500000e-03 1.500000e-03 Uoffset V 1.0 Ucc=Uee=15V
7 -1.500000e-03 1.500000e-03 Uoffset V 2.0 Ucc=Uee=15V
8 -1.500000e-03 1.500000e-03 Uoffset V 2.0 Ucc=Uee=15V
I can't make it integer, because in various data files there may be 'pin' values like Q_11
or A3
. How to assert the data in certain column to be a string?