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 can I join columns by DatetimeIndex, matching day, month and hour from data from different years?

I have a dataset with meteorological features for 2019, to which I want to join two columns of power consumption datasets for 2017, 2018. I want to match them by hour, day and month, but the data belongs to different years. How can I do that? The…
1
vote
1 answer

Can not resolve exception: "ValueError: The index must be timezone aware when indexing with a date string with a UTC offset"

I have a time-series that looks like this: y.index = pd.to_datetime(y.index) y.index = y.index.tz_localize(None) When I try to slice rows using the following expression I get the following…
user8270077
  • 4,621
  • 17
  • 75
  • 140
1
vote
0 answers

Datetime indexed dataframe log time scale (x-axis) plotting

I am working with a datetime indexed dataframe to visualize a temperature time series data. Here is a snippet of the data set Link to the hourly climate data: https://drive.google.com/file/d/1_2O0DpISmNfyt2_tEyopRxrzSKUd4n4u/view?usp=sharing I'm…
1
vote
0 answers

Time series index data update certain consecutive rows for all the columns

Date-index A B C D E F ::::::: 2019-06-01 3 4 5 9 2 4 2019-07-01 8 0 4 5 2 3 2019-08-01 1 8 9 7 5 6 2019-09-01 2 5 0 7 6 3 :::: Update values to all the column for the slice of data for the date index ** '2019-06-01' : '2019-09-01'** Is there any…
Chethan
  • 341
  • 2
  • 8
1
vote
2 answers

Combining columns to create datetimeindex in pandas

I want to combine date and time data in multiple columns of a Pandas Dataframe to create a DatetimeIndex. I have this: In: import pandas as pd df = pd.DataFrame({'the_date':['2020-03-26', '2020-03-26', '2020-03-25','2020-03-25'], …
doctorer
  • 1,672
  • 5
  • 27
  • 50
1
vote
1 answer

Convert TimeIndex of dataframe to DateTimeIndex in place

Coming from a MultiIndex: I can select the TimeIndex using get_level_values hist_vol_to_display.index.get_level_values('ts_timeonly') So all of the rows have happend on a specific date (e.g. 2019-09-16). What is an efficient way to replace the…
gies0r
  • 4,723
  • 4
  • 39
  • 50
1
vote
1 answer

Find values from a column in a DF at very specific times for every unique date

I asked this question and I got an answer which works for a general case with sequential and non missing data but not for my case specifically. I have a DF that looks as follows. eventTime MeteredEnergy Demand RunningHoursLamps 6/7/2018 0:00…
pynoob
  • 41
  • 5
1
vote
1 answer

Adjusting and reindexing a drifting time index dataframe

I have a dataset with an average interval of 22.xx seconds between recordings while the median interval is 21 seconds. I tried to use the DatetimeIndex.floor/ceil/round functions (with 20/21/22 second frequencies), but these lead to duplicated…
Atif
  • 345
  • 1
  • 4
  • 16
1
vote
1 answer

Pandas - How adding new empty rows with index coming from a list of DateTimeIndex?

I am sorry, I am kind of stuck. I would like to use DateTimeIndex coming from a column in a dataframe, to create new rows in another dataframe. These DateTimeIndex have to be used as indexes for the new rows. So with following data: import pandas as…
pierre_j
  • 895
  • 2
  • 11
  • 26
1
vote
3 answers

Dropping index column of mutiple excel files in python

I have multiple excel sheets that have identical column names. When I was saving the files from previous computations I forgot to set ‘Date’ as index and now all of them (40) have index columns with numbers from 1-200. If I load these into python…
Tamarie
  • 125
  • 2
  • 6
  • 18
1
vote
2 answers

Dataframe with date difference between index value and column name in each cell

I have a dataframe with one column, called maturity_dates. I also have a DateTimeIndex, called simulationdates. I want to create a dataframe, where each cell is the simulationdates value minus the MAT_DATE. Additionally, I want the figure to be…
muzzex
  • 157
  • 2
  • 16
1
vote
1 answer

Changing yearly dates to monthly dates and adding new values to populate monthly dates

I have the following dataframe data = pd.DataFrame({ 'date': [1988, 1989, 1990, 1991], 'value': [11558522, 12323552, 13770958, 18412280] }) Out[1]: date value 0 1988 11558522 1 1989 12323552 2 1990 13770958 3 1991 18412280 I then…
Tamarie
  • 125
  • 2
  • 6
  • 18
1
vote
2 answers

an array of datetime values

i have the following code where i try and populate an array with dates from 1988-2016 from datetime import datetime, timedelta t = np.arange(datetime(1988,1,1), datetime(2016,1,1), timedelta(days=365)).astype(datetime) This gives me the following…
Tamarie
  • 125
  • 2
  • 6
  • 18
1
vote
1 answer

Partition dataframe to overlapping segments

I have a dataframe with time indices and need to partition it into overlapping segments (say 5 days in length with 1 day offset). Here is a sample dataframe: import pandas as pd i=pd.date_range('05-01-2015', '21-05-2018',…
Al Guy
  • 191
  • 11
1
vote
1 answer

Sort by index and column

I am trying to sort by an index and column but to no avail. Partial dataset ID Element Data_Value Date 2005-01-01 USW00004848 TMIN 0 2005-01-01 USC00207320 TMAX 150 2005-01-01 USC00207320 TMIN …
Organic Heart
  • 517
  • 5
  • 16