Python Forum
Calculating median value from time data series
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculating median value from time data series
#2
I don't know whether or not there is some convenient way to do this, but simply sorting them and finding the middle (or 2 middles in the case of an even length sequence) is straightforward.

>>> length = len(df2_datetime_format)
>>> length
3
>>> df2_datetime_format
0   2018-08-22 02:00:00
1   2018-08-22 03:00:00
2   2018-08-22 04:00:00
Name: Value, dtype: datetime64[ns]
>>> sorted(df2_datetime_format)[length//2]
Timestamp('2018-08-22 03:00:00')
Not sure if that is sufficient to your needs.
Reply


Messages In This Thread
RE: Calculating median value from time data series - by Mekire - Aug-22-2018, 08:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help: Conversion of Electricity Data into Time Series Data SmallGuy 3 1,241 Oct-04-2023, 03:31 PM
Last Post: deanhystad
  Time Series Production Process Problem Mzarour 1 2,142 Feb-28-2023, 12:25 PM
Last Post: get2sid
  Finding the median of a column in a huge CSV file markagregory 5 1,806 Jan-24-2023, 04:22 PM
Last Post: DeaD_EyE
  reduce time series based on sum condition amdi40 0 1,112 Apr-06-2022, 09:09 AM
Last Post: amdi40
  How to accumulate volume of time series amdi40 3 2,327 Feb-15-2022, 02:23 PM
Last Post: amdi40
  Recommendations for ML libraries for time-series forecast AndreasPython 0 1,897 Jan-06-2021, 01:03 PM
Last Post: AndreasPython
  Find two extremum in data series Sancho_Pansa 0 1,701 Dec-04-2020, 02:06 PM
Last Post: Sancho_Pansa
  Time Series forecating with multiple independent variables Krychol88 1 1,881 Oct-23-2020, 08:11 AM
Last Post: DPaul
  how to handling time series data file with Python? aupres 4 3,024 Aug-10-2020, 12:40 PM
Last Post: MattKahn13
  How to denoise ECG Signal with median filter using WFDB for Python? fhp0223 0 2,198 Aug-05-2020, 07:10 AM
Last Post: fhp0223

Forum Jump:

User Panel Messages

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