xxxxxxxxxx
import pandas as pd # pip install pandas
#read the CSV file
data_file = =pd.read_csv('some_file.csv')
print(data_file)
xxxxxxxxxx
import csv
with open('file_csv.csv', newline='') as file:
reader = csv.reader(file)
for row in reader:
print(row)
xxxxxxxxxx
import csv
# open the file
with open('csvfile.csv' , 'r') as csvfile:
# create the object of csv.reader()
csv_file_reader = csv.reader(csvfile,delimiter=',')
for row in csv_file_reader:
print(row)
xxxxxxxxxx
import pandas as pd
df = pd.read_csv (r'Path where the CSV file is stored\File name.csv')
print (df)
xxxxxxxxxx
import csv
with open('some.csv', newline='') as f:
reader = csv.reader(f)
for row in reader:
print(row)
xxxxxxxxxx
import csv
with open('filename.csv') as csvfile:
spamreader = csv.reader(csvfile)
for row in spamreader:
print(row)
xxxxxxxxxx
# Way 1 : Import as dataframe
import pandas as pd
data = pd.read_csv("filename.csv")
# Way 2 : Import as list of tuples
import numpy as np
data = np.recfromcsv(file)
xxxxxxxxxx
import pandas as pd # pip install pandas
#read the CSV file
data_file = =pd.read_csv('some_file.csv')
print(data_file)
xxxxxxxxxx
import pandas as pd
import numpy as np
datas = pd.read_csv('data.csv')
a = datas.to_numpy()
print(a[0])