Skip to content

Instantly share code, notes, and snippets.

@zredlined
Created February 19, 2021 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zredlined/1649cd490fdafd4cb013bbebf4465d97 to your computer and use it in GitHub Desktop.
Save zredlined/1649cd490fdafd4cb013bbebf4465d97 to your computer and use it in GitHub Desktop.
def plot_timeseries(filenames: list):
""" Plot a list of timeseries CSVs to a single graph """
combined_df = pd.DataFrame()
for filename in filenames:
df = pd.read_csv(filename)
df['date'] = pd.to_datetime(df['date'])
df['label'] = filename
combined_df = pd.concat([combined_df, df])
combined_df.set_index('date', inplace=True)
combined_df.plot(color="label").show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment