dataframe from csv code example
Example 1: read_csv separator
import pandas as pd
df = pd.read_csv('data.csv',sep=';')
df = pd.read_csv('data.csv',delimiter=';')
Example 2: read csv uisng pandas
import pandas as pd
data = pd.read_csv('filelocation/fileName.csv')
Example 3: how to set up dataframe from csv
import pandas as pd
column_names = ['sepel lengh', 'sepel width', 'petal lengh', 'petal width', 'class']
iris = pd.read_csv('iris.csv', names=column_names)
print(iris)
Example 4: 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))
Example 5: convert csv to pandas dataframe
import pandas as pd
df = pd.read_csv("sample_data.csv")
column1,column2
1,2
3,4
5,6
column1 column2
0 1 2
1 3 4
2 5 6
Example 6: pandas read csv python
pd.read_csv('data.csv')