Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Select specific index for plot
#1
Hey guys,

I do have here an issue, which I cannot solve alone and thus need your help.

I do have a very large csv table with 27 columns. What I did was to use the multiindex command for "date" and "time", since I do have an object which is observed for several months for a time frame, so you can imagine

Index 1-----Index 2----Attribute

1.1.2018---- 12:00-----0.1
-------------12:01-----0.004
-------------12:03------10



1.2.2018-----13:00-----0.234
-------------13:02-----0.432
-------------13:03-----0.12



.
.
.
.
12.12.2018---11:00-----0.342
-------------11:02-----0.123
-------------11:00-----0.12


So I hope yo guys can imagine the table. So what I did to get a plot was
Data_plot["Attribute"].plot()
If I execute this command I do get the right plot, however the x-axis has the label "Date" and "time", so the multiindex items.

Question: How can I show on the x-axis the date and not the time??

I would be happy for any kind of help
Quote
#2
You probably need to get mean/median values of the attribute per day.

Try this:

your_df.groupby('date_index').mean()['Attribute'].plot()
Also, you can call more general (.transform) method instead of mean:

your_df.groupby('date_index').transform(pd.np.mean)['Attribute'].plot()
# or 
your_df.groupby('date_index').transform(lambda x: your_func(x))['Attribute'].plot()
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to find difference between two timestamp index python_newbie09 3 162 Aug-01-2019, 10:24 AM
Last Post: python_newbie09
  last index paul18fr 4 152 Jul-31-2019, 08:04 PM
Last Post: paul18fr
  pandas: can we look for the index of a string paul18fr 2 193 Jul-31-2019, 08:25 AM
Last Post: paul18fr
  Dynamically placing axes in subplots via dataframe plot naftis 1 188 Jul-29-2019, 12:10 AM
Last Post: scidam
  select data based on indice Staph 4 164 Jul-15-2019, 02:05 AM
Last Post: scidam
  Plot/Image analysis %of colored area(grid) TiBotLCPP 0 147 Jul-09-2019, 02:33 PM
Last Post: TiBotLCPP
  Giving index when joining dataframes kw42chan 1 218 Jul-06-2019, 06:19 AM
Last Post: kw42chan
  finding index to given value from dataset gamma 3 255 May-26-2019, 06:26 PM
Last Post: heiner55
  Help rendering a pylab plot cyberman 1 234 May-15-2019, 05:27 AM
Last Post: scidam
  MatPlotLib 2d plot of current density? ruben 0 178 May-13-2019, 06:47 AM
Last Post: ruben

Forum Jump:


Users browsing this thread: 1 Guest(s)