Feb-20-2021, 08:23 AM
(This post was last modified: Feb-20-2021, 08:24 AM by ju21878436312.)
Hey out there,
Question 1:
Hi there, I've created timedeltas
I have experimenced with
Question 2:
Furthermore, I would like plot column "0.3" over "Time". My attempts using matplotlib were not successfull by now.
Question 3:
Can I determine the Time, at which "0.3" is above or below a certain value for the first time?
minimal_datetime.ipynb:
Question 1:
Hi there, I've created timedeltas
df['Time'] = df['Time'] - df.Time.min()and would now like to add a time increment of "57 s" to each line in the Time series.
I have experimenced with
df['Time'] = df['Time'] + df.seconds(57)but this does not work. Can someone help me?
Question 2:
Furthermore, I would like plot column "0.3" over "Time". My attempts using matplotlib were not successfull by now.
Question 3:
Can I determine the Time, at which "0.3" is above or below a certain value for the first time?
minimal_datetime.ipynb:
import pandas as pd
from datetime import datetime, timedelta
df = pd.read_csv('minimal_in.txt')
df.head(5)
# overwrite Time to combine Time and Year
df['Time'] = df['Year']+ ", "+ df['Time']
df
# change to datetime
df['Time']=pd.to_datetime(df.Time)
df.head()
df.dtypes
# Creation of timedeltas
df['Time'] = df['Time'] - df.Time.min()
#df['Time'] = df['Time'] + df.seconds(57)
df
# Write csv
df.to_csv('minimal_out.csv', index=False)minimal_in.txt:,Year,Time,Channel,time,0.3,0.5,1.0,3.0,5.0,10.0 0,29.01.2001,15:22:36,1,2,39,9,0,0,0,0 1,29.01.2001,15:22:39,1,2,622,243,66,1,0,0 2,29.01.2001,15:22:41,1,2,803,311,57,0,0,0 3,29.01.2001,15:22:44,1,2,2826,1217,352,1,0,0 4,29.01.2001,15:22:46,1,2,3282,1487,405,5,0,0minimal_out.csv:
,Unnamed: 0,Year,Time,Channel,time,0.3,0.5,1.0,3.0,5.0,10.0 0,29.01.2001,0 days 00:00:00.000000000,1,2,39,9,0,0,0,0 1,29.01.2001,0 days 00:00:03.000000000,1,2,622,243,66,1,0,0 2,29.01.2001,0 days 00:00:05.000000000,1,2,803,311,57,0,0,0 3,29.01.2001,0 days 00:00:08.000000000,1,2,2826,1217,352,1,0,0 4,29.01.2001,0 days 00:00:10.000000000,1,2,3282,1487,405,5,0,0Thanks in advance!
