I am having difficulty creating a stacked bar chart time series from my Pandas dataframe (image below). I would like to have the 'Date' on the x axis, the 'Hours' on the y axis, and each bar to show the time spent with each group in 'Category'.
Do I need to use Pandas - Groupby function? The dataframe is a sample. I have hundreds of rows of data from 2018 to 2020.

pandas.DataFrame.groupbyon'date'and'group', while aggregating.sumon'time'.dtextractor is used to extract only the.datecomponent of the'date'column.'Date'column of your dataframe is properly formatted as adatetimedtype, withdf.Date = pd.to_datetime(df.Date)dfg, must be shaped into the correct form, which can be accomplished withpandas.DataFrame.pivot.pandas.DataFrame.plot.barand use thestackedparameter.pandas.DataFrame.plotfor all the parameters.Imports and Data Transformation
.pivot_table, which both reshapes and aggregatesindex=df.date.dt.dateis used so the index doesn't include the time component, since the data for the entire day is being aggregated.Plot
pandas.DataFrame.barh