-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathread_data.py
More file actions
24 lines (20 loc) · 786 Bytes
/
read_data.py
File metadata and controls
24 lines (20 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pandas as pd
import os
def read():
for root, dirs, files in os.walk(os.getcwd()):
dirs = dirs
for data in files:
if data.endswith('.csv'):
df = pd.read_csv(os.path.join(root, data))
pd.set_option('display.max_rows', None)
df.drop('Source', axis=1, inplace=True)
print(df)
def read_scraped(folder_name, filename):
for root, dirs, files in os.walk(f'{os.getcwd()}/{folder_name}'):
dirs = dirs
for data in files:
if filename == data:
df = pd.read_csv(os.path.join(root, data))
pd.set_option('display.max_rows', None)
df.drop('Source', axis=1, inplace=True)
print(f'Data Frame:\n\n{df}')