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
1
vote
1 answer

Should Pandas DatetimeIndex.weekday return an index or a numpy array?

I have a Pandas DatetimeIndex object (obtained from the index of a dataframe) and I need the weekday of each element. I have been running this with Python 3.6.5 (64-bit) on Windows and with Pandas 0.22.0 and obtaining an Int64Index object: e.g. In: …
doctorer
  • 1,672
  • 5
  • 27
  • 50
1
vote
1 answer

Using set_index in time series to eliminate holiday data rows from DataFrame

I am trying to eliminate holiday data from a time series pandas DataFrame. The instructions I am following processes a DatetimeSeries and uses the function set_index() to apply this DatetimeSeries to the DataFrame which results in a time series…
1
vote
0 answers

Pandas DatetimeIndex issue with last week of year

Continuing on my previous question, I have another dataframe that the week column starts with 201553. When I change weekly columns to timestamp, belwo occured. Please take a look. a = pd.Int64Index([201553, 201601, 201602, 201603, 201604, 201605,…
EJ Kang
  • 455
  • 2
  • 5
  • 17
1
vote
2 answers

re-setting date only in pandas series datetime index

I have a pandas series myS import pandas as pd The index is a set of strings containing time only myS.index Out[28]: Index([u'12:00 AM', u'12:14 AM', u'12:18 AM', u'12:25 AM', u'12:26 AM', u'12:37 AM', u'12:41 AM', u'12:47 AM', u'12:55…
00__00__00
  • 4,834
  • 9
  • 41
  • 89
1
vote
2 answers

How can DataFrames be merged such that the values of one that correspond to *months* get applied to all *datetimes* of the other?

This question is conceptually similar to this one. I've got two DataFrames. One has a set of values corresponding to certain times and dates (df_1). The other has a set of values corresponding to certain months (df_2), specified as the first instant…
BlandCorporation
  • 1,324
  • 1
  • 15
  • 33
1
vote
1 answer

Pandas DateTimeIndex - Shifting over index

So I'm working on some technical analysis using Pandas, however I'm struggling with the DateTimeIndex, since a lot of financial data doesn't have a consistent frequency. I use pandas_datareader to get yahoo finance data containing DateTimeIndex,…
MrBobJamesBob
  • 143
  • 1
  • 8
1
vote
1 answer

Number of business days between DateTimeIndex and columns of dates

I have a dataframe of dates with a DateTimeIndex like this: pd.DataFrame(['01-20-2017']*len(pd.date_range('01-01-2017', '01-30-2017')), columns=['Dates'], index=pd.date_range('01-01-2017', '01-30-2017')) I would like to add a column that counts the…
Panda_User
  • 169
  • 1
  • 3
  • 12
1
vote
1 answer

Pick Timestamps in Certain Time Range From a DatetimeIndex

I have a bunch of DataFrames where I want to select only data that occurs at certain times during the day. Say, between 9am and 5pm. But the data starts before 9, and finishes after 5. import numpy as np import pandas as pd start =…
Batman
  • 8,571
  • 7
  • 41
  • 80
1
vote
2 answers

Select rows between two DatetimeIndex dates

I have a CSV file of the following format: vm,time,LoadInt1 abc-webapp-02,2017-05-31 10:00:00,3.133333 abc-webapp-02,2017-05-31 10:05:00,0.000000 abc-webapp-02,2017-05-31 10:10:00,0.000000 abc-webapp-02,2017-05-31…
Arnab Biswas
  • 4,495
  • 3
  • 42
  • 60
1
vote
3 answers

distance to multiple irregular sampled events in pandas

I have an irregular sampled timeseries event Time 2013-01-01 01:40:53.072 n 2013-01-01 01:41:25.563 e 2013-01-01 01:51:23.293 e 2013-01-01 01:57:14.168 e 2013-01-01 01:58:07.273 …
lorenzo
  • 79
  • 4
1
vote
1 answer

How do I make a pandas datatimeindex into twice daily frequency?

I have a pandas df that looks like this: Open_fut Close_fut Date 2017-05-12 20873.0 20850.0 2017-05-11 20887.0 20869.0 2017-05-10 20891.0 20888.0 2017-05-09 20943.0 20886.0 2017-05-08 …
cJc
  • 813
  • 1
  • 11
  • 33
1
vote
1 answer

Hashable Pandas DatetimeIndex

I'm trying to memoize a method foo(dti: DatetimeIndex) using the @functools.lru_cache() annotation. However, it complains with TypeError: unhashable type: 'DatetimeIndex'. Since DatetimeIndex objects are immutable, there should be a good way to use…
Ken Williams
  • 22,756
  • 10
  • 85
  • 147
1
vote
1 answer

Shifting values in datetimeindex of pandas dataframe

I have a df with a DateTimeIndex of 30 minute intervals over a long period (> 1 year), so >17520 rows. For reasons related to daylight savings, two of the index values are repeated in the index and two values are missing. So the duplicated values…
doctorer
  • 1,672
  • 5
  • 27
  • 50
1
vote
1 answer

Referencing Pandas dataframe using a datetimeindex

I'm having difficulty accessing a pandas dataframe using a DateTimeIndex. I have created a dataframe with a DateTimeIndex and a column of zeros import pandas as pd earliest = pd.Timestamp('2012-01-01 06:00:00') latest = pd.Timestamp('2014-12-01…
doctorer
  • 1,672
  • 5
  • 27
  • 50
1
vote
2 answers

Pandas TimeGrouper & Merge on datetimeindex

I'm a newbie and I've tried looking at several posts and can't seem to get this to work... I'm the problem, I'm sure. Trying to combine and condense two data sets, one has the date and weight of fruit purchased and the other has historical daily…
Programming_Learner_DK
  • 1,509
  • 4
  • 23
  • 49