Skip to content

Instantly share code, notes, and snippets.

@jiobu1
Created April 28, 2021 15:23
Show Gist options
  • Save jiobu1/8c630242ea467b2d42caf917a12cf841 to your computer and use it in GitHub Desktop.
Save jiobu1/8c630242ea467b2d42caf917a12cf841 to your computer and use it in GitHub Desktop.
create dictionary of cities
# Create list of cities
cities_list = list(population['City,State'])
# group cities from the population_melt.csv
def rnd_series(city):
subset = population_melt[population_melt['City,State']== city]
dates = (pd.DataFrame({'ds': pd.to_datetime(population_melt['ds'])}))
return subset
# create dictionary of city name and grouped population_melt.csv
series = [rnd_series(city) for city in cities_list]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment