1

I am trying to show how many people are working in a specific time frame over multiple periods, and would like to display this as a chart using Seaborn. I'm looking to create something like this: enter image description here

My data comes with a single entry per line for each time period, with a start time and end time. Like so: enter image description here

My thought was to create a dataframe with the columns created using period_range columns = pd.period_range(start=start_datetime, end=end_datetime, freq='H'), then fill in the relevant cells if that individual worked during that half hour.
This is the complete code:

columns2 = pd.period_range(start='2022-01-04 23:00:00', end='2022-01-05 07:00:00', freq='H')
index2 = pd.Index(['Jim', 'John', 'Hannah', 'Clyde'])
hours = pd.DataFrame(index=index2, columns=columns2, data=False)
hours

enter image description here

But I'm having trouble selecting the cells and changing their values. Any advice how to achieve this, or achieve the goal of the project in general would be greatly appreciated!

Tzvi L
  • 45
  • 1
  • 7

0 Answers0