-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorm_front_subset.py
More file actions
29 lines (22 loc) · 857 Bytes
/
Copy pathstorm_front_subset.py
File metadata and controls
29 lines (22 loc) · 857 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
25
26
27
28
29
from utilities.data_management import make_path, open_w_pandas
base = make_path('data/prepared_data/')
source_name = 'storm-front-full'
destination_name = 'storm-front'
variants = ['', '_partial']
sample_size = 250000
print('Prepared params, starting selection')
sample_indexes = None
for variant in variants:
source_path = base / (source_name + variant + '.csv')
destination_path = base / (destination_name + variant + '.csv.gz')
source = open_w_pandas(source_path)
print('Loaded data variant', variant)
# Define the same subset for both variants
if sample_indexes is None:
sample = source.sample(n=sample_size)
sample_indexes = sample.index.values
else:
sample = source.iloc[sample_indexes]
sample.to_csv(destination_path)
print('Finished variant', variant)
print('All writes complete.')