I have a pandas dataframe (df) that looks like this:
A B C 0 1 10 1234 1 2 20 0
I want to save this dataframe in a fixed format. Th
df['B'] = df['B'].apply(lambda t: (' '*(4-len(str(t)))+str(t))) df['C'] = df['C'].apply(lambda t: (' '*(5-len(str(t)))+str(t))) df.to_csv('path_to_file.csv', index=False)