Python Forum
Plot time series data
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plot time series data
#3
(Mar-04-2023, 03:56 PM)noisefloor Wrote: Hi,

if you combine the first six columns to one column holding a datetime object, plotting should be easy.

Regards, noisefloor

Here is my current solution, which I'd like to shorten if possible:

import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv('data.csv')
df['Date']=pd.to_datetime(df[['Year', 'Month', 'Day', 'Hour', 'Minute','Second']])
df=df.drop(['Year', 'Month', 'Day', 'Hour', 'Minute','Second'], axis=1)
df=df.dropna()
plt.plot(df['Date'],df['HYY_META.VOC_M137_1250'])
Reply


Messages In This Thread
Plot time series data - by schniefen - Mar-04-2023, 02:17 PM
RE: Plot time series data - by noisefloor - Mar-04-2023, 03:56 PM
RE: Plot time series data - by schniefen - Mar-04-2023, 04:14 PM
RE: Plot time series data - by noisefloor - Mar-04-2023, 04:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation URGENT: How to plot data from text file. Trying to recreate plots from MATLAB JamieAl 4 3,752 Dec-03-2023, 06:56 AM
Last Post: Pedroski55
  Fit straight line to pandas time series data with semilog plot schniefen 2 1,625 Mar-10-2023, 01:08 PM
Last Post: jefsummers
  Help on Time Series problem Kishore_Bill 1 4,895 Feb-27-2020, 09:07 AM
Last Post: Kishore_Bill
  How to plot date series in matplotlib? StrybolData 2 8,457 Jan-25-2018, 07:13 PM
Last Post: StrybolData
  Visualisation of gaps in time series data ulrich48155 11 19,606 Jul-04-2017, 11:47 PM
Last Post: zivoni
  Removing data in a plot ulrich48155 3 3,897 Jun-19-2017, 06:31 PM
Last Post: zivoni
  10fold cross-validation on time series ulrich48155 5 9,334 May-08-2017, 04:36 PM
Last Post: ulrich48155

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020