-
Notifications
You must be signed in to change notification settings - Fork 3
/
fetch_and_save.py
40 lines (32 loc) · 1.74 KB
/
fetch_and_save.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
"""
@author: David R Hagen
@license: MIT
"""
# Note: Google will cut you off if you try to run all this at once!
from general_setup import fetch_all_data,good_XXth_days_year,good_XX_days_of_year,bad_XXth_days_of_year,bad_nth_days_of_year,bad_XX_days_of_year,old_style_days_of_year
# Fetch good XXth data
good_XXth_data = fetch_all_data(good_XXth_days_year)
good_XXth_data = good_XXth_data[['year'] + good_XXth_days_year] # Reorder columns because Google sorts them funny
n_years = len(good_XXth_data.index)
good_XXth_data.to_csv('good_XXth_data.csv', index=False)
# Fetch good XX data
good_XX_data = fetch_all_data(good_XX_days_of_year)
good_XX_data = good_XX_data[['year'] + good_XX_days_of_year]
good_XX_data.to_csv('good_XX_data.csv', index=False)
# Fetch bad XXth data
bad_XXth_data = fetch_all_data(bad_XXth_days_of_year)
bad_XXth_data = bad_XXth_data[['year'] + [col for col in bad_XXth_days_of_year if col in bad_XXth_data.columns]]
bad_XXth_data.to_csv('bad_XXth_data.csv', index=False)
# Fetch bad nth data
bad_nth_data = fetch_all_data(bad_nth_days_of_year)
bad_nth_data = bad_nth_data[['year'] + [col for col in bad_nth_days_of_year if col in bad_nth_data.columns]]
bad_nth_data.to_csv('bad_nth_data.csv', index=False)
# Fetch bad XX data
bad_XX_data = fetch_all_data(bad_XX_days_of_year)
bad_XX_data = bad_XX_data[['year'] + [col for col in bad_XX_days_of_year if col in bad_XX_data.columns]]
bad_XX_data.to_csv('bad_XX_data.csv', index=False)
# Fetch old-style data
old_style_data = fetch_all_data(old_style_days_of_year)
old_style_data = old_style_data[['year'] + [col for col in old_style_days_of_year if col in old_style_data.columns]]
old_style_data.to_csv('old_style_data.csv', index=False)