time-series

Pandas: Zigzag segmentation of data based on local minima-maxima

假如想象 提交于 2021-02-06 20:07:36
问题 I have a timeseries data. Generating data date_rng = pd.date_range('2019-01-01', freq='s', periods=400) df = pd.DataFrame(np.random.lognormal(.005, .5,size=(len(date_rng), 3)), columns=['data1', 'data2', 'data3'], index= date_rng) s = df['data1'] I want to create a zig-zag line connecting between the local maxima and local minima, that satisfies the condition that on the y-axis, |highest - lowest value| of each zig-zag line must exceed a percentage (say 20%) of the distance of the previous

Pandas: Zigzag segmentation of data based on local minima-maxima

荒凉一梦 提交于 2021-02-06 20:01:36
问题 I have a timeseries data. Generating data date_rng = pd.date_range('2019-01-01', freq='s', periods=400) df = pd.DataFrame(np.random.lognormal(.005, .5,size=(len(date_rng), 3)), columns=['data1', 'data2', 'data3'], index= date_rng) s = df['data1'] I want to create a zig-zag line connecting between the local maxima and local minima, that satisfies the condition that on the y-axis, |highest - lowest value| of each zig-zag line must exceed a percentage (say 20%) of the distance of the previous

Pandas: Zigzag segmentation of data based on local minima-maxima

折月煮酒 提交于 2021-02-06 20:01:29
问题 I have a timeseries data. Generating data date_rng = pd.date_range('2019-01-01', freq='s', periods=400) df = pd.DataFrame(np.random.lognormal(.005, .5,size=(len(date_rng), 3)), columns=['data1', 'data2', 'data3'], index= date_rng) s = df['data1'] I want to create a zig-zag line connecting between the local maxima and local minima, that satisfies the condition that on the y-axis, |highest - lowest value| of each zig-zag line must exceed a percentage (say 20%) of the distance of the previous

Several time series to DataFrame

只愿长相守 提交于 2021-02-06 16:54:11
问题 I have problem merging several time series to a common DataFrame. The example code I'm using: import pandas import datetime import numpy as np start = datetime.datetime(2001, 1, 1) end = datetime.datetime(2001, 1, 10) dates = pandas.date_range(start, end) serie_1 = pandas.Series(np.random.randn(10), index = dates) start = datetime.datetime(2001, 1, 2) end = datetime.datetime(2001, 1, 11) dates = pandas.date_range(start, end) serie_2 = pandas.Series(np.random.randn(10), index = dates) start =

Several time series to DataFrame

…衆ロ難τιáo~ 提交于 2021-02-06 16:36:34
问题 I have problem merging several time series to a common DataFrame. The example code I'm using: import pandas import datetime import numpy as np start = datetime.datetime(2001, 1, 1) end = datetime.datetime(2001, 1, 10) dates = pandas.date_range(start, end) serie_1 = pandas.Series(np.random.randn(10), index = dates) start = datetime.datetime(2001, 1, 2) end = datetime.datetime(2001, 1, 11) dates = pandas.date_range(start, end) serie_2 = pandas.Series(np.random.randn(10), index = dates) start =

Several time series to DataFrame

家住魔仙堡 提交于 2021-02-06 16:31:32
问题 I have problem merging several time series to a common DataFrame. The example code I'm using: import pandas import datetime import numpy as np start = datetime.datetime(2001, 1, 1) end = datetime.datetime(2001, 1, 10) dates = pandas.date_range(start, end) serie_1 = pandas.Series(np.random.randn(10), index = dates) start = datetime.datetime(2001, 1, 2) end = datetime.datetime(2001, 1, 11) dates = pandas.date_range(start, end) serie_2 = pandas.Series(np.random.randn(10), index = dates) start =

Several time series to DataFrame

风格不统一 提交于 2021-02-06 16:30:30
问题 I have problem merging several time series to a common DataFrame. The example code I'm using: import pandas import datetime import numpy as np start = datetime.datetime(2001, 1, 1) end = datetime.datetime(2001, 1, 10) dates = pandas.date_range(start, end) serie_1 = pandas.Series(np.random.randn(10), index = dates) start = datetime.datetime(2001, 1, 2) end = datetime.datetime(2001, 1, 11) dates = pandas.date_range(start, end) serie_2 = pandas.Series(np.random.randn(10), index = dates) start =

Pandas Rolling Window - datetime64[ns] are not implemented

北城以北 提交于 2021-02-06 10:14:30
问题 I'm attempting to use Python/Pandas to build some charts. I have data that is sampled every second. Here is a sample: Index, Time, Value 31362, 1975-05-07 07:59:18, 36.151612 31363, 1975-05-07 07:59:19, 36.181368 31364, 1975-05-07 07:59:20, 36.197195 31365, 1975-05-07 07:59:21, 36.151413 31366, 1975-05-07 07:59:22, 36.138009 31367, 1975-05-07 07:59:23, 36.142962 31368, 1975-05-07 07:59:24, 36.122680 I need to create a variety of windows to look at the data. 10, 100, 1000 etc. Unfortunately

Pandas Rolling Window - datetime64[ns] are not implemented

会有一股神秘感。 提交于 2021-02-06 10:13:40
问题 I'm attempting to use Python/Pandas to build some charts. I have data that is sampled every second. Here is a sample: Index, Time, Value 31362, 1975-05-07 07:59:18, 36.151612 31363, 1975-05-07 07:59:19, 36.181368 31364, 1975-05-07 07:59:20, 36.197195 31365, 1975-05-07 07:59:21, 36.151413 31366, 1975-05-07 07:59:22, 36.138009 31367, 1975-05-07 07:59:23, 36.142962 31368, 1975-05-07 07:59:24, 36.122680 I need to create a variety of windows to look at the data. 10, 100, 1000 etc. Unfortunately

How to cut a vector or column into intervals in R [duplicate]

放肆的年华 提交于 2021-02-05 11:46:39
问题 This question already has answers here : Convert continuous numeric values to discrete categories defined by intervals (2 answers) Closed 1 year ago . I have the following columns in a dataframe which difference between each row is 0.012 s : Time 0 0.012 0.024 0.036 0.048 0.060 0.072 0.084 0.096 0.108 I want to come up with intervals starting from beginning increasing by 0.030, so intervals or time window of every 0.03 later to be used in group by. 回答1: You can try findInterval like