Skip to content

Instantly share code, notes, and snippets.

@rohitrajiit
Created June 2, 2020 09:05
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 rohitrajiit/26440fb3c4b833feca63ca68409f335e to your computer and use it in GitHub Desktop.
Save rohitrajiit/26440fb3c4b833feca63ca68409f335e to your computer and use it in GitHub Desktop.
data = data.sort_values(by=['state', 'Dates'])
data['dailypositive'] = data['positive'].diff()
data['dailytested'] = data['totaltested'].diff()
data.loc[data['state']!=data['state'].shift(1), 'dailytested'] = data['totaltested']
data.loc[data['state']!=data['state'].shift(1), 'dailypositive'] = data['positive']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment