“DataFrame to CSV” Code-Antworten

Code, wie Pandas CSV -Datei speichern

df.to_csv('out.csv')
Gifted Gerbil

DataFrame to CSV

import pandas as pd

# Dataframe example
df = pd.DataFrame({'col_A':[1,5,7,8],'col_B':[9,7,4,3]})

# Save dataframe as csv file in the current folder
df.to_csv('filename.csv', index = False, encoding='utf-8') # False: not include index
print(df)

#Note: to Save dataframe as csv file in other folder use instead:

''' 
df.to_csv('Path/filename.csv', index = False, encoding='utf-8') # Replace 'Path' by the wanted folder
''';

Gabriel Juri

Schreiben Sie DataFrame in CSV Python

df.to_csv (r'C:\Users\John\Desktop\export_dataframe.csv', index = None, header=True) 
Clear Copperhead

DataFrame to CSV

df.to_csv(file_name, sep='\t', encoding='utf-8')
Clean Curlew

DataFrame to CSV

df.to_csv("name.csv")
Clean Curlew

DataFrame to CSV

df.to_csv(r'Path where you want to store the exported CSV file\File Name.csv', index = False)
likesh

Ähnliche Antworten wie “DataFrame to CSV”

Fragen ähnlich wie “DataFrame to CSV”

Weitere verwandte Antworten zu “DataFrame to CSV” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen