diff --git a/CSV_files/read_csv.py b/CSV_files/read_csv.py index 5b416b75..a59be8ed 100644 --- a/CSV_files/read_csv.py +++ b/CSV_files/read_csv.py @@ -1,9 +1,9 @@ import csv import pandas as pd -def read_using_DictReader(): +def read_using_DictReader(path): # opening the CSV file - with open('CSV_files/assets/addresses.csv', mode ='r') as file: + with open(path, mode ='r') as file: # reading the CSV file csvFile = csv.DictReader(file) @@ -18,7 +18,9 @@ def read_by_pandas_head(): def read_by_pandas_tail(): data=pd.read_csv('CSV_files/assets/addresses.csv') return data.tail() + if __name__=="__main__": + print(read_using_DictReader('assets/addresses.csv')) print(read_using_DictReader()) print(read_by_pandas_head()) print(read_by_pandas_tail())