Skip to content

Commit 9c8029e

Browse files
Merge pull request #6 from Mahmoud-alzoubi95/CSV_files
Csv files
2 parents 041fab1 + 8bad6b6 commit 9c8029e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

CSV_files/read_csv.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import csv
22
import pandas as pd
33

4-
def read_using_DictReader():
4+
def read_using_DictReader(path):
55
# opening the CSV file
6-
with open('CSV_files/assets/addresses.csv', mode ='r') as file:
6+
with open(path, mode ='r') as file:
77
# reading the CSV file
88
csvFile = csv.DictReader(file)
99

@@ -18,7 +18,9 @@ def read_by_pandas_head():
1818
def read_by_pandas_tail():
1919
data=pd.read_csv('CSV_files/assets/addresses.csv')
2020
return data.tail()
21+
2122
if __name__=="__main__":
23+
print(read_using_DictReader('assets/addresses.csv'))
2224
print(read_using_DictReader())
2325
print(read_by_pandas_head())
2426
print(read_by_pandas_tail())

0 commit comments

Comments
 (0)