import pandas as pd
data = {'x':['011','012','013'],'y':['022','033','041']}
Df = pd.DataFrame(data = data,type = str)
Df.to_csv("path/to/save.csv")
How to specify column type(I need string) using pandas.to_csv method in Python?
3.2k views Asked by Alexander Semenov At
1
To achieve such result it will be easier to export directly to xlsx file, even without setting dtype of DataFrame.
I've tried also some other methods like prepending apostrophe or quoting all fields with ", but it gave no effect.