Python Forum
datetime intervals - dataframe selection (via plotted data)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
datetime intervals - dataframe selection (via plotted data)
#1
I have plotted a Dataframe over a day and I would like to consider the negative parts (<0) marked in blue when x becomes positive for the first time and when it turns negative for the "first" time too but for a long time.
NB: intervals marked in black although negative cannot be taken into account.

[Image: IGaEo6C.png]

[Image: IGaEPob.png]

csv file: csv

here is my approach

x_start = 0
day_start = datetime.time(00,00,00)
day_end = datetime.time(23,59,59)
df_list = []

# Dataframe to List
'''df_list = [df.columns.values.tolist()] + df.values.tolist()
print(df_list)'''

for col in df:
    if df[col] in range (day_start, day_end):
       # Dataframe where x is negative 
       df_neg = df[(df<0).all(1)]

# ...

 # Honestly I dont know how to continue ... but I'm trying :)
   
thank you in advance
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to insert data in a dataframe? man0s 1 1,312 Apr-26-2022, 11:36 PM
Last Post: jefsummers
  Filter data based on a value from another dataframe column and create a file using lo pawanmtm 1 4,242 Jul-15-2020, 06:20 PM
Last Post: pawanmtm
  How does pyplot know what was plotted by the output of pandas.DataFrame(...).cumprod( codeowl 2 2,163 Mar-28-2020, 08:27 AM
Last Post: j.crater
  How to add data to the categorical index of dataframe as data arrives? AlekseyPython 1 2,313 Oct-16-2019, 06:26 AM
Last Post: AlekseyPython
  Confidence intervals over time with polynomial regression jjameson 0 3,280 May-16-2019, 02:22 PM
Last Post: jjameson
  Inserting data from python list into a pandas dataframe mahmoud899 0 2,580 Mar-02-2019, 04:07 AM
Last Post: mahmoud899
  [SOLVED on SO] Downsizing non-representative data in DataFrame volcano63 1 2,151 Sep-28-2018, 12:56 PM
Last Post: volcano63
  Pandas nested json data to dataframe FrankC 1 10,115 Aug-14-2018, 01:37 AM
Last Post: scidam
  Trying to import JSON data into Python/Pandas DataFrame then edit then write CSV Rhubear 0 4,073 Jul-23-2018, 09:50 PM
Last Post: Rhubear
  linspace not dividing equal intervals sheel 0 2,368 Jan-16-2018, 04:28 PM
Last Post: sheel

Forum Jump:

User Panel Messages

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