All Questions
Tagged with unix-timestamp pandas
51
questions
0
votes
2
answers
50
views
pandas date column to unix timestamp accounting for timezone and varying datetime formats
I have multiple data frames with a datetime column as a string. Datetime formats vary across columns in the dataframe or across dataframes. I want to get a unix timestamp that gets interpreted by an ...
0
votes
2
answers
91
views
Pandas to_datetime method giving incorrect year when converting Unix Timestamp
When using to_datetime method of Pandas Dataframe to convert a Unix Timestamp to a Formatted DateTime in a column of data collected from a Data Logger I get the wrong year by 20 years. I have checked ...
1
vote
1
answer
380
views
Safely convert a Pandas datetime Series to Int64 epoch timestamp, preserving nulls
Consider a datetime-dtype Series containing some null values:
import pandas as pd
t = pd.date_range('2022-01-01', '2022-01-02', freq='4H').to_series('t')
t.iat[2] = None
2022-01-01 00:00:00 2022-...
0
votes
1
answer
45
views
How can I add together 2 timeseries that have unix timestamps if the unix timestamps don't align?
I have Orderbook update data for 2 different assets and the updates happen at different unix timestamps, so the timeseries are both of different length and have different indexes. How should I go ...
0
votes
1
answer
264
views
Create an integer timestamp that corresponds to a Pandas Timestamp's timezone
Suppose we have a dataset with a UNIX timestamp in milliseconds:
data = [
{
"unix_ts": 1669291200000,
"val": 10
},
{
"unix_ts": ...
0
votes
1
answer
102
views
Converting to UNIX time
I have a .csv file that contains:
created_at
actual_delivery_time
2015-02-06 22:24:17
2015-02-06 23:27:16
2015-02-10 21:49:25
2015-02-10 22:56:29
I want to convert these columns from datetime to ...
0
votes
1
answer
151
views
Pandas data_range to epoch in miliseconds
I am generating a data range using pandas and after transforming to epoch, however I realized that the mktime function is given me my local timezone and not UTC.
How do I get an list of dates in UTC ...
0
votes
2
answers
904
views
Convert GPS time to datetime in Python
I have a pandas dataframe with numerous columns, one of which is the time in GPS time, like such:
GPS_time
1635751985
1635751985
1635751986
1635751987
1635751987
..........
How would I go ...
0
votes
1
answer
1k
views
AttributeError: 'Series' object has no attribute 'timetuple' [duplicate]
I am trying to convert a pandas column DateTime (UTC) which seems like this df_1['MESS_DATUM'] = 202209250000 to unixtime. My code looks like this:
df_1['MESS_DATUM'] = calendar.timegm(df_1['...
1
vote
1
answer
371
views
From unix timestamps to relative date based on a condition from another column in pandas
I have a column of dates in unix timestamps and i need to convert them into relative dates from the starting activity.
The final output should be the column D, which expresses the relative time from ...
0
votes
1
answer
82
views
TypeError wants Integers are getting String
This code was originally made in a .ipynb file.
I am getting the TypeError: list indices must be integers or slices, not str
can't seem to figure out how to fix this problem.
The result should be that ...
1
vote
1
answer
606
views
Can't convert DataFrame Index to datetime
I can't convert my dataframe index (unix epoch time) to a datetime index. I've tried so many things as seen below, and still it's not working.
# ...
for item in mongodb.find({"time": {"$...
0
votes
1
answer
75
views
Concatenate datasets that don't share timestamp values
I have two different csv files that correspond to a person's HRV (csv no1) and their emotions (csv no2). The first dataset used UNIX timestamps to capture the HRV values and the other recorded the ...
1
vote
1
answer
290
views
Assign values from Numpy Array to Pandas DataFrame based on almost matching unix timestamp
I am given a 2D numpy array and a huge pandas DataFrame. A dummy example of them would look somewhat like this:
arr = np.array([[1648137283, 0],
[1648137284, 1],
[...
1
vote
1
answer
302
views
How to correctly append rows from a df to another based on timestamps on Python? Pandas related
I currently have 253 csv files with the following filenames:
1. ALICEUSDT-1h-2021-06-01.csv
2. ALICEUSDT-1h-2021-06-02.csv
3. ALICEUSDT-1h-2021-06-03.csv
4. ALICEUSDT-1h-2021-06-06.csv
5. ALICEUSDT-1h-...