File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -117,20 +117,24 @@ of our generation plants from the SWITCH input files.
117117import pandas as pd
118118
119119# READ
120- gen_projects = pd.read_csv(" generation_projects_info.csv" , index_col = False )
121- costs = pd.read_csv(" gen_build_costs.csv" , index_col = False )
122- predetermined = pd.read_csv(" gen_build_predetermined.csv" , index_col = False )
120+ kwargs = dict (
121+ index_col = False ,
122+ dtype = {" GENERATION_PROJECT" : str }, # This ensures that the project id column is read as a string not an int
123+ )
124+ gen_projects = pd.read_csv(" generation_projects_info.csv" , * kwargs)
125+ costs = pd.read_csv(" gen_build_costs.csv" , * kwargs)
126+ predetermined = pd.read_csv(" gen_build_predetermined.csv" , * kwargs)
123127
124128# JOIN TABLES
125129gen_projects = gen_projects.merge(
126- costs,
127- on = " GENERATION_PROJECT" ,
130+ costs,
131+ on = " GENERATION_PROJECT" ,
128132)
129133
130134gen_projects = gen_projects.merge(
131- predetermined,
132- on = [" GENERATION_PROJECT" , " build_year" ],
133- how = " left" # Makes a left join
135+ predetermined,
136+ on = [" GENERATION_PROJECT" , " build_year" ],
137+ how = " left" # Makes a left join
134138)
135139
136140# FILTER
You can’t perform that action at this time.
0 commit comments