Skip to content

Commit 3b12293

Browse files
committed
Add jupyter_view.py helper script
1 parent 5766e15 commit 3b12293

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ What you can do though is copy it to a new file, e.g. "algorithm_v1.py" and make
1717
- Display results in some nicer way than just csv in github
1818
- Check in the scripts used to generate the source data csv
1919
- Automate generating the source data (incrementally!) when the generation scripts are updated. Maybe a database would be better for this than a csv?
20+
21+
### Misc
22+
- If you want to inspect the csv files in jupyter/pandas/vscode, there's a helper script at scripts/jupyter_view.py

scripts/jupyter_view.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#%%
2+
## Run this to set up
3+
import pandas as pd
4+
from pathlib import Path
5+
6+
#%%
7+
## Just choose one of the below patterns, according to what you want to see
8+
which_file = 'grantmaking_*.csv'
9+
#%%
10+
which_file = 'enriched_websites_*.csv'
11+
#%%
12+
which_file = 'projects*.csv'
13+
14+
#%%
15+
## Now run this to load the data
16+
data_dir = '../data'
17+
most_recent = sorted(Path(data_dir).glob(which_file))[-1]
18+
df = pd.read_csv(Path(data_dir) / most_recent.name)
19+
20+
#%%
21+
## Explore the data however you choose
22+
df.head()
23+
24+
# %%

0 commit comments

Comments
 (0)