lukemelas commited on
Commit
bb46e54
1 Parent(s): b740044

Add dataset creation utilities

Browse files
dataset-creation-utilities/create-year-lists.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import numpy as np
3
+ from tqdm import tqdm
4
+
5
+ df = pd.read_feather("hupd_metadata_2022-02-22.feather", columns=['application_number', 'filing_date'])
6
+ assert df['filing_date'].dt.year.isnull().sum() == 2
7
+ df['year'] = df['filing_date'].dt.year.fillna(2018.0).astype(int)
8
+ years = df['year'].value_counts()
9
+ print(years)
10
+ for year in tqdm(years.index):
11
+ df_year_numbers = df['application_number'][df['year'] == year]
12
+ df_year_numbers.to_frame().to_csv(f'lists/{year}.txt', sep=' ', index=False, header=False)
13
+ print(f'saved {year}')
dataset-creation-utilities/lists/2004.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2005.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2006.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2007.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2008.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2009.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2010.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2011.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2012.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2013.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2014.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2015.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2016.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2017.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/lists/2018.txt ADDED
The diff for this file is too large to render. See raw diff
 
dataset-creation-utilities/move-files.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ for year in 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 # 2004
2
+ do
3
+ mkdir years/${year}
4
+ cat hupd-subset/lists/$year.txt | xargs -i mv distilled/{}.json years/${year}
5
+ done