File size: 552 Bytes
bb46e54 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import pandas as pd
import numpy as np
from tqdm import tqdm
df = pd.read_feather("hupd_metadata_2022-02-22.feather", columns=['application_number', 'filing_date'])
assert df['filing_date'].dt.year.isnull().sum() == 2
df['year'] = df['filing_date'].dt.year.fillna(2018.0).astype(int)
years = df['year'].value_counts()
print(years)
for year in tqdm(years.index):
df_year_numbers = df['application_number'][df['year'] == year]
df_year_numbers.to_frame().to_csv(f'lists/{year}.txt', sep=' ', index=False, header=False)
print(f'saved {year}')
|