tiaotiao
0
Q:

read_csv

import pandas as pd #import pandas
#syntax: pd.read_csv('file_location/file_name.csv')
data = pd.read_csv('filelocation/fileName.csv') #reading data from csv 
4
df = pd.read_csv('data.csv') 
10
# importing Pandas library 
import pandas as pd 
  
pd.read_csv(filepath_or_buffer = "pokemon.csv") 
  
# makes the passed rows header 
pd.read_csv("pokemon.csv", header =[1, 2]) 
  
# make the passed column as index instead of 0, 1, 2, 3.... 
pd.read_csv("pokemon.csv", index_col ='Type') 
  
# uses passed cols only for data frame 
pd.read_csv("pokemon.csv", usecols =["Type"]) 
  
# reutruns pandas series if there is only one colunmn 
pd.read_csv("pokemon.csv", usecols =["Type"], 
                              squeeze = True) 
                                
# skips the passed rows in new series 
pd.read_csv("pokemon.csv", 
            skiprows = [1, 2, 3, 4]) 
5
pd.read_csv('data.csv')  # doctest: +SKIP
5
you should be in the same dir as .py file 

df = pd.read_csv('your_file_name.csv')
1
>>> pd.read_csv('data.csv')  
0

New to Communities?

Join the community