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

How to reindex a datetime-based multiindex in pandas

I have a dataframe that counts the number of times an event has occured per user per day. Users may have 0 events per day and (since the table is an aggregate from a raw event log) rows with 0 events are missing from the dataframe. I would like to…
FirefoxMetzger
  • 2,880
  • 1
  • 18
  • 32
1
vote
1 answer

Equation solver (like goal seek) for timeseries in python

Is there a solver that works like goal seek in excel, but can also be used for time series? For example, lets say I have 3 timeseries variables df['Var1'], df['Var2'], df['Var3'] and an equation:(df['Var1'] / X ) + (X * df['Var2']) = df['Var3']. I…
1
vote
1 answer

Filter a dataframe with datetime index using another dataframe with date index

I have two dataframes, one dataframe has index with date and time, the other dataframe's index only has date. Now I'd like to filter rows of first dataframe if its date is within 2nd dataframe's index. I can do it but very complicated to use two…
roudan
  • 3,082
  • 5
  • 31
  • 72
1
vote
2 answers

Create a dataframe with two columns (hour and minute) using a datetime index

Hi all I have a list with Datetime indexes in it, with time interval 15 minutes (see screenshot) I would like to create a dataframe with 2 columns only, the first with 'hour' and the second with 'minute' using this Datetime index. The result I…
1
vote
2 answers

TypeError: Cannot join tz-naive with tz-aware DatetimeIndex

all! I am trying to generate results of this repo https://github.com/ArnaudBu/stock-returns-prediction for stocks price prediction based on financial analysis. Running the very first step 1_get_data.py I come across an error: TypeError: Cannot…
NeuralAI
  • 43
  • 2
  • 10
1
vote
4 answers

Pandas: Extracting values from a DatetimeIndex

I have a Pandas DataFrame whose rows and columns are a DatetimeIndex. import pandas as pd data = pd.DataFrame( { "PERIOD_END_DATE": pd.date_range(start="2018-01", end="2018-04", freq="M"), "first": list("abc"), "second":…
Nick Vence
  • 754
  • 1
  • 9
  • 19
1
vote
1 answer

Converting Datetimeindex of a dataframe to week numbers

I am very new to Python and cannot seem to solve the problem on my own. Currently I have a dataset which I already converted to a DataFrame using pandas which has a datetimeindex according to yyyy-mm-dd-HH-MM-SS with time stamps of minutes. The…
b-roijers
  • 11
  • 2
1
vote
1 answer

How to extract only time from pandas DatetimeIndex while maintaining the 'datetime64[ns]' dtype?

I have generated a DatetimeIndex which looks like: DatetimeIndex(['1970-01-01 09:30:00.015105074', '1970-01-01 09:30:00.059901970', '1970-01-01 09:30:00.113246707', '1970-01-01 09:30:00.113246707', …
QuantCode
  • 23
  • 5
1
vote
1 answer

How to match Datetimeindex for all but the year?

I have a dataset with missing values and a Datetimeindex. I would like to fill this values with the mean values of other values reported at the same month, day and hour. If there is no values reported at this specific month/day/hour for all years I…
fidu13
  • 37
  • 7
1
vote
1 answer

Slicing pandas DateTimeIndex with steps

I often deal with pandas DataFrames with DateTimeIndexes, where I want to - for example - select only the parts where the hour of the index = 6. The only way I currently know how to do this is with…
Matthijs Kramer
  • 502
  • 7
  • 19
1
vote
0 answers

How to set Custom Business Day End Frequency in Pandas

I have a pandas dataframe with an unusual DatetimeIndex. The frame contains daily data (end of each day) from 1985 to 1990 but some "random" days are missing: DatetimeIndex(['1985-01-02', '1985-01-03', '1985-01-04', '1985-01-07', …
LisaBinder
  • 41
  • 5
1
vote
1 answer

pvlib - bifacial.pvfactors_timeseries() ValueError: Buffer has wrong number of dimensions (expected 1, got 2)

I'm working with pvlib/pvfactors bifacial.pvfactors_timeseries and I'm having some issues with the timestamps. I use a DatetimeIndex as it can be seen: times = pd.date_range('2021-01-01', '2021-01-02', closed='left', freq='1min', …
1
vote
2 answers

Getting the rolling.sum of row values with irregular time intervals

I am trying to get the rolling.sum of my time series. However, the rows have varying time intervals (see below my df_water_level_US1 dataframe): DATE TIMEREAD WATERLEVEL(M) DateAndTime 0 01/01/2016 0:00:15 0.65 01/01/2016 0:00:15 1…
kiwi_kimchi
  • 345
  • 3
  • 12
1
vote
1 answer

Plot each single day on one plot by extracting time of DatetimeIndex without for loop

I have a dataframe including random data over 7 days and each data point is indexed by DatetimeIndex. I want to plot data of each day on a single plot. Currently my try is the following: import numpy as np import pandas as pd import…
Saeed
  • 598
  • 10
  • 19
1
vote
2 answers

How to visualize absence/presence data

Being all new to pandas, I have a probably very basic question. I have a camera in a tawny owl nest box and I noted down the time the owl spends in the nestbox. I want to visualize the time in the nestbox using Python. I made a pandas DatetimeIndex,…
Sander
  • 35
  • 2