Read CSV Python Pandas code example
Example 1: python read csv
import pandas as pd
data = pd.read_csv('data.csv')
print(data)
Example 2: read_csv separator
import pandas as pd
df = pd.read_csv('data.csv',sep=';')
df = pd.read_csv('data.csv',delimiter=';')
Example 3: command to read file in python using pandas
import panda as pd
file_csv = pd.read_csv("file path")
file_excel = pd.read_excel("file path")
file_json = pd.read_json("file path")
file_html = pd.read_html("file path")
file_localClipboard = pd.read_clipboard("file path")
file_MSExcel = pd.read_excel("file path")
file_HDF5 = pd.read_hdf("file path")
file_Feather = pd.read_feather("file path")
file_msgpack = pd.read_msgpack("file path")
file_stata = pd.read_stata("file path")
file_SAS = pd.read_sas("file path")
file_paythonPickle = pd.read_pickle("file path")
file_SQL = pd.read_sql("file path")
file_google_big_query = pd.read_gbq("file path")
Example 4: read csv uisng pandas
import pandas as pd
data = pd.read_csv('filelocation/fileName.csv')
Example 5: pandas read csv
df = pd.read_csv('data.csv')
Example 6: pandas read csv
import pandas as pd
cereal_df = pd.read_csv("/tmp/tmp07wuam09/data/cereal.csv")
cereal_df2 = pd.read_csv("data/cereal.csv")
print(pd.DataFrame.equals(cereal_df, cereal_df2))