Skip to content

Instantly share code, notes, and snippets.

@StephenFordham
Created June 23, 2021 14:01
Show Gist options
  • Save StephenFordham/0eaddaeea848bc75bb7d756db54a85b3 to your computer and use it in GitHub Desktop.
Save StephenFordham/0eaddaeea848bc75bb7d756db54a85b3 to your computer and use it in GitHub Desktop.
data_shaping
keys = [i for i in range(65)]
all_dataframes = {}
for i, county in zip(keys, df['Provider County'].unique()):
df2 = df[df['Provider County'] == county].sort_values('Year', ascending=True)
all_dataframes[i] = df2
master_df = []
for i in all_dataframes:
master_df.append(all_dataframes[i])
df_all = pd.concat(master_df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment