Questions tagged [datetimeindex]

Immutable ndarray of datetime64 data, represented internally as int64

Immutable ndarray of datetime64 data, represented internally as int64, and which can be boxed to Timestamp objects that are subclasses of datetime and carry metadata such as frequency information.

325 questions
0
votes
3 answers

Do I have to sort dates chronologically to use pandas.DataFrame.ewm?

I need to calculate EMA for a set of data from csv file where dates are in descending order. When I apply pandas.DataFrame.ewm I get EMA for the latest (by date) equal to the value. This is because ewm starts observation from top to bottom in…
deal2k
  • 203
  • 4
  • 12
0
votes
2 answers

DateTimeIndex Pandas .Series attribute Error

Right now, my data frame has two columns: a DateTimeIndex and a Load column. I want to add a third column with a consecutive second count, from zero, based on the DateTimeIndex. import pandas as pd import matplotlib.pyplot as plt from scipy import…
AHalperin
  • 49
  • 1
  • 9
0
votes
1 answer

Missing Data and Graphing with Pandas and Matplotlib

I want my matplotlib plot to display my df's DateTimeIndex as consecutive count data (in seconds) on the x-axis and my df's Load data on the y axis. Then I want to overlap it with a scipy.signal find_peaks result (which has an x-axis of consecutive…
AHalperin
  • 49
  • 1
  • 9
0
votes
0 answers

how can I change a datetimeindex format index into a panda dataset with the contents of another column?

I would like to change the index of the following dataframe Timestamp Open High Low Close Volume 2020-09-18 16:12:00 1.07852 1.07852 1.07834 1.07841 111 2020-09-18 16:11:00 1.07843 1.07853 1.07841 1.07851 …
0
votes
0 answers

Shift vales based on the first level index (Timestamp)

Is there a better way how to shift the values of a dataframe column based only on the first level of index? For each week I have calculated the weekly sum (Column 1) and I want the second columns the sum shifted one week before. I managed to do this…
onr
  • 296
  • 4
  • 18
0
votes
0 answers

Using loc with a list from a DatetimeIndex returns error

When I create a DatetimeIndex object with date_range() and feed list of datelabels to loc[[ ]] an error is returned. I never had any problem with a list of indexlabels in loc. Simple code example (python 3 in Jupyter Notebook): import pandas as…
0
votes
1 answer

how to select partial dataframe by datetimeindex?

I have a Dataframe with a datetimeindex and a datetimeindex and i need to select only the rows from the datetimeindex. how to do? ix = pd.DatetimeIndex(['2019-07-18 00:00:00', '2019-07-18 00:01:00', '2019-07-18 00:02:00', '2019-07-18 00:03:00',…
La-Li-Lu-Le-Low
  • 191
  • 2
  • 15
0
votes
1 answer

Why the operator "*" between a dataframe and a series is giving me a len(firstSeries)*len(secondSeries) with NaNs?

I got res = dataframe * dataframe['column'] with for the first dataframe and for dataframe['column'] And it outputs me : res : 2020-08-17 05:00:00 2020-08-17 05:15:00 …
TheHaricover
  • 47
  • 1
  • 6
0
votes
1 answer

pandas market calendars missing first period

Why does the first period aka 9:30 get cut off? It returns the first period as 10:00. That is incorrect. What am I doing wrong? import pandas_market_calendars as mcal nyse = mcal.get_calendar('NYSE') early = nyse.schedule(start_date="2020-07-02",…
0
votes
1 answer

Convert pandas df with data in a "list column" into a time series in long format. Use three columns: [list of data] + [timestamp] + [duration]

The aim is to convert a dataframe with a list column as the data column (and thus with just one timestamp and duration per row) into a time series in long format with a datetimeindex for each single item. In the result, there is no sequence/list per…
questionto42
  • 7,175
  • 4
  • 57
  • 90
0
votes
1 answer

No longer possible to index a pandas DatetimeIndex with a date?

I've just upgraded to pandas 1.1 from 0.24 and I feel like I have lost my mind. Is it true that you can no longer index a DatetimeIndex with, you know, a date? #This now fails! import datetime as dt s = pd.Series([1,2],…
Dave Anderson
  • 667
  • 1
  • 7
  • 14
0
votes
2 answers

In Python with Pandas, I have a function to change the index of DataFrame. But, it also changes the index of the original DataFrame

I have a following analysis.py file. The function group_analysis changes the datetime index of df_input by the Count column of df_input # analysis.py import pandas as pd def group_analysis(df_input): df_input.index = df_input.index -…
david78
  • 173
  • 11
0
votes
1 answer

How to substract datetime index by a series of numbers in Pandas?

I have a DataFrame similar to the following, and I want to subtract the DateTimeIndex by numbers in the Day_Count column. import pandas as pd x = pd.DataFrame(np.arange(1,14), index = pd.date_range('2020-01-01', periods = 13, freq= 'D'), columns =…
david78
  • 173
  • 11
0
votes
1 answer

Pandas: find the first couple of timestamp indices that are the same given two dataframes

I have the following df1: Value 2020-06-02 00:00:00 17 2020-06-03 00:00:00 10 2020-06-05 00:00:00 86 and the following df2: Value 2020-06-01 00:00:00 16 2020-06-04 00:00:00 9 2020-06-05 00:00:00…
Zizzipupp
  • 1,301
  • 1
  • 11
  • 27
0
votes
1 answer

Is there a way to get the element 1 before/after upper indexing limit?

I have a Dataframe with Timeindex and a Timeindex till which I want to slice the dataframe. df[:upper_Timeindex_Timevalue] The Question: How do I get the element before this "limiting-index"? df[:upper_Timeindex_Timevalue -1] # this wouldnt work…
Benoid
  • 209
  • 1
  • 4
  • 11