Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

export data csv python

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
''';

Comment

PREVIOUS NEXT
Code Example
Python :: dataframe to csv python 
Python :: python except keyboardinterrupt 
Python :: factorial sequence code in python with while loops 
Python :: make a list from 0 to n python 
Python :: unzip file python 
Python :: python cls statement using os module 
Python :: python split string in pairs 
Python :: NameError: name ‘np’ is not defined 
Python :: how to delete every row in excel using openpyxl 
Python :: python link shortener 
Python :: create guid python 
Python :: python pip graphviz 
Python :: fetch row where column is equal to a value pandas 
Python :: add search field to django admin 
Python :: check numpy version 
Python :: use selenium without opening browser 
Python :: how to separate year from datetime column in python 
Python :: save fig plot dataframe 
Python :: python selenium run javascript 
Python :: how to search for a specific file extension with python 
Python :: tf 1 compatible colab 
Python :: json file to dict python 
Python :: tkinter give button 2 commands 
Python :: import status in django rest framework 
Python :: set axis title matplotlib 
Python :: How to fix snap "pycharm-community" has "install-snap" change in progress 
Python :: opencv draw two images side by side 
Python :: colab cuda version 
Python :: keras import optimizer adam 
Python :: virtual environment mac 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =