igdb/Code/database/parse_csv.py

17 lines
464 B
Python
Raw Normal View History

from pandas import read_csv, concat, DataFrame
from iso3166 import countries
def select_columns() -> [DataFrame]:
min_year = 2010
fields = ["POLITICAL_UNIT", "WGMS_ID", "YEAR"]
iter_csv = read_csv(
"../../Assets/WGMS-FoG-2019-12-D-CHANGE.csv",
skipinitialspace=True,
usecols=fields,
iterator=True,
chunksize=100,
)
data = concat([chunk[chunk["YEAR"] > min_year] for chunk in iter_csv])
return data