Skip to content

Instantly share code, notes, and snippets.

@deanjamesss
Created January 29, 2021 01:18
Show Gist options
  • Select an option

  • Save deanjamesss/b424b587914a72986dd6cca37f21aa7c to your computer and use it in GitHub Desktop.

Select an option

Save deanjamesss/b424b587914a72986dd6cca37f21aa7c to your computer and use it in GitHub Desktop.
# Unpivot the original DataFrame.
df = df.melt(id_vars=['staff_no', 'name'], var_name='year',
value_name='hours')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment