isudatateam / datateam

Consider iterating dictionary PYL-C0201
Anti-pattern
Major
3 months ago3 months old
Consider iterating the dictionary directly instead of calling .keys()
 51        cropyear = valid.year + 1
 52        plantdates[site][cropyear].append(valid)
 53
 54for site in plantdates.keys(): 55    climate_site = sitemeta[site]["climate_site"]
 56    table = "alldata_%s" % (climate_site[:2],)
 57    for yr in range(2011, 2014):
Consider iterating the dictionary directly instead of calling .keys()
 57        e.append(col)
 58    print(extract)
 59    mydict = {}
 60    for plotid in extract.keys(): 61        mydict[plotid] = df[extract[plotid]].copy()
 62        rename = {df.columns[0]: "valid"}
 63        for col in mydict[plotid].columns[1:]: