Search code examples
pythonplotlydata-science

How do i plot a bar graphic with the groupby made column


I'm an Environmental Engineer, trying to make a leap change to the data science area which interests me more.

I'm new to Python, I work at a company that evaluates air quality data and I think that if I automate the analysis, I should save some time.

I've imported the CSV files with environmental data from the past month, did some filter in that just to make sure that the data were okay and did a groupby just analyse the data day-to-day (I need that in my report for the regulatory agency).

The step by step of what I did:

medias = tabela.groupby(by=["Data"]).mean()
display (tabela)

enter image description here

As you can see there's a column named Data, but when I do the info check it not recognizes the Data as a column.

print (medias.info())

enter image description here

How can I solve this? I need to plot some graphs with the concentration of rain and dust per day.


Solution

  • After grouping, please do a reset index

    medias = tabela.groupby(by=["Data"]).mean()
    medias = medias.reset_index()