Trying to use a small example to explain my case:
df = pd.DataFrame([[1,1],[1,2],[1,3],[1,4]],columns=['A', 'B'])
d1 = df['B'].apply(lambda x: '{0:0>3}'.format(x))
df['B'] = d1
df.head()
df.to_csv()
I want to save changed df into a new csv file, which should be like:
Out[28]: A B
0 1 001
1 1 002
2 1 003
3 1 004
But after saved it used df.to_csv(), the new data file has no changes:
Out[32]:
A B
0 1 1
1 1 2
2 1 3
3 1 4
Anyone could happy to tell how to fix it? many thanks!