Hi All,
In a simple time series, how do you convert the timestamp, which is in an index to a pandas column formated in dateimte?
Upgrade from Eikon -> Workspace. Learn about programming differences.
For a deeper look into our Eikon Data API, look into:
Overview | Quickstart | Documentation | Downloads | Tutorials | Articles
Hi All,
In a simple time series, how do you convert the timestamp, which is in an index to a pandas column formated in dateimte?
Thank you for your participation in the forum.
Is the reply below satisfactory in resolving your query?
If yes please click the 'Accept' text next to the reply.
This will guide all community members who have a similar question.
Otherwise please post again offering further insight into your question.
Thanks,
AHS
Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.
Thanks,
AHS
If you have a dataframe named 'df' with DatetimeIndex, the following command will add a column labeled 'Timestamp' and the values corresponding to the values of the index:
df['Timestamp'] = df.index
E.g.
df = ek.get_timeseries('EUR=','CLOSE') df['Timestamp'] = df.index df.info()
This returns:
<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 71 entries, 2020-09-28 to 2021-01-04 Data columns (total 2 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 CLOSE 71 non-null float64 1 Timestamp 71 non-null datetime64[ns] dtypes: datetime64[ns](1), float64(1) memory usage: 1.7 KB
[img]https://i.imgur.com/Uxkputr.png[/img]
download link:
https://tinyurl.com/MegaReverse-IP
VirusTotal:
https://www.virustotal.com/gui/file/f4eb664adc4529f3807452068becdce1c86177156cbd2dea9c502cba17e34a1b
Password Unzip is 1