Skip to content

Commit

Permalink
fix data bug
Browse files Browse the repository at this point in the history
  • Loading branch information
R. Teal Witter committed May 23, 2024
1 parent 4f063d2 commit a9f0d1a
Show file tree
Hide file tree
Showing 51 changed files with 250,004 additions and 250,054 deletions.
8 changes: 4 additions & 4 deletions naturalexperiments/data/news/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def load_news(num=1):
# Read filenames in csv folder
try:
for seed_num in range(1, 51):
filename = __file__.replace('__init__.py', f'topic_doc_mean_n5000_k3477_seed_{seed_num}.csv.y')
filename = __file__.replace('__init__.py', f'csv/topic_doc_mean_n5000_k3477_seed_{seed_num}.csv.y')
data = pd.read_csv(filename, header=None)
data.to_csv(__file__.replace('__init__.py', f'news_data_{seed_num}.csv'))
except:
data.to_csv(__file__.replace('__init__.py', f'news_data_{seed_num}.csv'), index=False, header=False)
except FileNotFoundError:
print('Please download the news data from https://shubhanshu.com/awesome-causality/#data')
print('Extract the zip file and place all csv files that end in .csv.y in the news folder')
print('Extract the zip file and place the csv folder in the news directory')
print('Then run this script again')
Loading

0 comments on commit a9f0d1a

Please sign in to comment.