I have 17 data frames to which I wish to add a new column using for loop based on certain conditions. Any suggestions on how this can be done?
I have a list called custom_region = []
and 17 dataframes again stored in a list called CGdfs
.
CGdfs = [CGdf_2002, CGdf_2003, CGdf_2004, CGdf_2005, CGdf_2006, CGdf_2007, CGdf_2008, CGdf_2009, CGdf_2010, CGdf_2011, CGdf_2012, CGdf_2013, CGdf_2014, CGdf_2015, CGdf_2016, CGdf_2017, CGdf_2018]
I am appending new values to custom_region
based on certain conditions in a loop. This list I have to finally append to each of these dataframes to create a column for each of them.
So, custom_region[0]
to CGdf_2002
custom_region[1]
to CGdf_2003
and so on..