How to prevent exponential notation in CSV export with pandas DataFrame containing mixed data types

I encountered a similar issue recently while working with a mixed-type DataFrame in pandas. To avoid the automatic conversion of large floating-point numbers into exponential notation during CSV export, I found that converting the numeric columns to strings with formatted outputs was the most effective solution. Here’s a snippet that worked for me:

    data_copy = data.copy()
    data_copy['amounts'] = data_copy['amounts'].apply(lambda x: f'{x:.6f}')
    data_copy.to_csv('output.csv')

Alternatively, you can set pandas display options temporarily:

    with pd.option_context('display.float_format', '{:.6f}'.format):
        data.to_csv('output.csv')

Both methods will preserve the integrity of your string columns while ensuring that numbers are printed in standard notation.