What is the syntax of reading file ,writing file in python.and How to read csv file and excel file in DataFrames(pandas).
Asked
Active
Viewed 1.7k times
-2
-
4Possible duplicate of [Reading an Excel file in python using pandas](https://stackoverflow.com/questions/17063458/reading-an-excel-file-in-python-using-pandas) – snipsnipsnip Nov 06 '18 at 09:36
4 Answers
1
To read:
df = pd.read_excel('filename.xlsx')
df = pd.read_csv('filename.csv')
To write:
df.to_csv('filename.csv')
df.to_excel('filename.xlsx')
if you just googled "pandas read excel"..

dejanmarich
- 1,235
- 10
- 26
0
import pandas as pd
df=pd.read_csv('file_name.csv')
this will result into Dataframe.If you want to read a specific column and want output as series.
df=pd.read_csv('file_name.csv',usecols=['col_name'],squeeze=True)

The_Scan_Master
- 136
- 1
- 5