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
0 answers

shift is slow / does not work in pandas 18

I am on anaconda pandas 0.18.1. I used to do this on pandas 12 to lag some values in a multi-index dataframe, where index level 0 = date, and index level 1 = security ID (3 years of daily data): In [1]: testDB.head(2) Out[1]:
hfquant
  • 11
  • 1
1
vote
1 answer

Finding if atleast one entry from a specified month string exists in Pandas datetime index

I have a pandas dataframe test_df that looks like this: reading 01-Jan-2016 00:00:00.000 20.464020 02-Jan-2016 00:00:00.000 22.440950 03-Jan-2016 00:00:00.000 27.181500 04-Jan-2016…
Shivam Gaur
  • 1,032
  • 10
  • 17
1
vote
1 answer

Pandas: Select data between Sunday 23:00-Friday 23:00 (1 year span)

I have the timeseries of Euro-US Dollar Exchange Rate at minute granularity spanning the entire 2015 year, including non-trading days (ex.weekends) where the timeseries value get repeated for the entire non-trading period. I need to discard such…
SergeGardien
  • 137
  • 2
  • 11
1
vote
1 answer

Pandas DatetimeIndex strange behaviour

I handle a DataFrame, which index is string, year-month, for example: index = ['2007-01', '2007-03', ...] however, the index is not full. e.g. 2007-02 is missing. What I want is to reindex the DataFrame with full index. What I have tried: In [60]:…
PhilChang
  • 2,591
  • 1
  • 16
  • 18
1
vote
1 answer

resample dataframe with python

I need to resample a dataframe using pandas.DataFrame.resample function like this : data.set_index('TIMESTAMP').resample('24min', how='sum') This works without no problem, but when I try call the fucntion with 'xmin" where x is a general argment …
Poisson
  • 1,543
  • 6
  • 23
  • 34
1
vote
0 answers

How to set correct x axis with datetime index so that intervals are proper in the Bokeh plot?

I read csv having many columns including a Date column, as pandas dataframe called 'breakageDf'. Being 'object' type I convert the date column to string first then to datetime object breakageDf["Date"] =…
1
vote
2 answers

Reindex method of Pandas does not respect the set frequency

I have a Pandas DataFrame with a daily DatetimeIndex. I am trying to apply the Resample method to sum the values into a monthly series like this: >>> aggVols.resample('M',axis=1).sum() But when I try this I get the error TypeError: Only valid with…
David
  • 327
  • 1
  • 3
  • 11
1
vote
2 answers

Getting complete datetime index of data frame in miliseconds using groupby method

I have a dataframe (df) with the index as datetime index in "%Y-%m-%d %H:%M:%S.%f" format i.e 2012-06-16 15:53:42.457000. I am trying to create groups of 1 second using groupby method i.e x=…
user2083529
  • 715
  • 3
  • 13
  • 25
1
vote
1 answer

Create monthly pandas DatetimeIndex

I have a dataframe with 12 values that I want to convert to DatetimeIndex type months = df['date'] #e.g. '2016-04-01' idx = pd.date_range(months[0], months[11], freq='M') However, the resulting DatetimeIndex length is only 11, which should be…
ayin
  • 105
  • 2
  • 11
1
vote
1 answer

Munge tuples of yearly fiscal data with element date-labels into a time-series in Python Pandas

I am trying to convert SQL -> .csv data dump flat file into a time-series for each company. The crux for me is that the data is organized into yearly tuples of 4 quarters. The quarter-end dates are Fiscal quarters given in the first tuple of each…
Erik
  • 412
  • 1
  • 5
  • 11
1
vote
2 answers

How to make a Datetimeindex not be the index in a dataframe

I'd like to have access to the special methods provided by the Datetimeindex class such as month, day, etc. However I can't seem to make a series in a dataframe be a Datetimeindex without making it the dataframe's index. Take the following…
ChrisArmstrong
  • 2,491
  • 8
  • 37
  • 60
0
votes
0 answers

Pandas datetimeindex intraday min, max, first, last and sum

I have 5 minutes stock data dataframe for multiple days. I am trying to get first, current, min, max values for columns within the day in same index and same dataframe. I have a pandas dataframe with 5 minutes stock…
0
votes
1 answer

How to pivot a DatetimeIndex Series on Pandas

I have a Pandas Series of hourly data for a whole year, where the index is the DatetimeIndex, and a column with one value for each hour in the year. I want to create a Dataframe so that each row represents the day in the year (1-365) and each column…
p_vall_do
  • 25
  • 4
0
votes
1 answer

To split python DataFrame

I have a big DataFrame with a date_time as index , for exemple : 2022-09-30 15:45:00. A row with data of one day every minute row1 2022-09-10 10:05 data1 data2 data3 row2 2022-09-10 10:06 data4 data5 data6 etc... The index range…
GAO
  • 1
0
votes
0 answers

TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of ‘Index’

import yfinance as yf import pandas as pd import numpy as np import matplotlib.pyplot as plt ticker = [“ZIM”,“ANDE”,“ARKK” ] stocks = yf.download(ticker, start = “2010-01-01”, end = “2023-01-01”) ANDE ANDE.ANDE.resample(“M”).last()