330 questions
1
vote
3
answers
170
views
How to set a cell value based on the time range in DatetimeIndex in Pandas
I am trying to create a new column in a pandas dataframe, where the values are based on ranges of the time (hours and minute) of the DatetimeIndex.
Here is my dataframe:
DatetimeIndex ...
0
votes
1
answer
87
views
How to vectorize Pandas DateTimeIndex
I'm trying to avoid a for loop with DateTimeIndex. I have a function get_latest that looks up the most recent wage index value. When I step through the dates of pay days, the lookup works fine. When I ...
0
votes
0
answers
79
views
How to do partial indexing in pandas?
I am learning pandas and came across partial indexing in date time index. however, i am struggling to print a particular month's data using partial indexing.
These are the above code tried to print ...
0
votes
0
answers
49
views
Datetime index not converting correctly to datetimeindex
I have a csv file with data and a datetime stamp, and I am trying to correctly format the datetime so that I can resample the data.
I have a csv that I have imported of the format:
...
0
votes
1
answer
529
views
Create Pandas DateTimeIndex with 3 digits millisecond precision
I have a dataframe like this:
lat lon year month day hour minute second millisecond
0.0 0.0 2023.0 11.0 22.0 10.0 15.0 34.0 345.0
0.0 0.0 2023.0 11.0 22.0 10.0 23.0 ...
0
votes
1
answer
172
views
How to build "product" datetime index from a list of dates and a list of times in pandas?
I have
a list of dates (size=7713): [date(1994,5,25), ..., date(2023,12,19)]
a list of times (basically 5 minute interval of a day, size=288): [time(0, 0), ..., time(23, 55)]
I want to build a ...
1
vote
1
answer
85
views
How does `pd.date_range()` creates an object of `DatetimeIndex`, without calling any method of the class `DatetimeIndex`?
This is the csv file I am using, which has day column as index
temperature windspeed event
day
2017-01-01 32.0 6.0 Rain
2017-01-...
2
votes
1
answer
3k
views
ValueError: Invalid frequency when resampling
I want to resample a temporal series index with pandas resample. In my case I divide to total period by the amount of intervals to get the step. Then sometimes I get the error:
ValueError: Invalid ...
0
votes
0
answers
54
views
Pandas datetimeindex intraday min, max, first, last and sum [duplicate]
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 ...
2
votes
3
answers
121
views
select all the values between two days independently from the year in pandas
Let's say that I have the following dataframe:
dates,qq
1900-01-01,1
1900-01-02,2
1900-01-03,3
1900-01-04,4
1900-01-05,5
1900-01-06,6
1900-01-07,7
1901-01-01,8
1901-01-02,9
1901-01-03,10
1901-01-04,11
...
0
votes
1
answer
123
views
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 ...
0
votes
1
answer
65
views
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 ...
2
votes
1
answer
167
views
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 ...
1
vote
1
answer
466
views
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['...
1
vote
1
answer
870
views
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 ...