Skip to content

Instantly share code, notes, and snippets.

@edersonbadeca
Created June 16, 2022 16:57
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 edersonbadeca/5f13689d09e5926528f81e9fa075c26b to your computer and use it in GitHub Desktop.
Save edersonbadeca/5f13689d09e5926528f81e9fa075c26b to your computer and use it in GitHub Desktop.
calculate deploy per hour dora metrics
# coding: utf-8
# This sample code shows how to create a timeseries based on date periods to calculate
# the frequency that an event occurs in a hour.
# Links:
# - https://pandas.pydata.org/docs/reference/api/pandas.date_range.html
# - https://pandas.pydata.org/docs/getting_started/intro_tutorials/09_timeseries.html?highlight=resample#resample-a-time-series-to-another-frequency
import pandas as pd
import numpy as np
rng = pd.date_range('1/1/2011', periods=5, freq='60S')
ts = pd.Series(np.random.randint(0, 5, len(rng)), index=rng)
ts.resample('H').agg(['count'])
print('ok')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment