dates coming out as wrong number

I have two problems:
1. sometimes when I run the below code chunk, I get an empty data frame, and sometimes I do not.
2. when I don't get an empty data frame, the dates are reported erroneously, as in not in a proper date-time format. (note that I am trying to get the data into a csv file with dates in a specific format)
Here is my code and a screenshot of the output showing the erroenous date-time format.
import refinitiv.data as rd
rd.open_session()
syntax = "SCREEN(U(IN(Equity(active,public,primary))), IN(TR.TRBCIndustryCode,54102030,54101010,54101020),CURN=USD)"
TSfields = ["TR.F.PeriodEndDate(IncludeSpl=Yes)","TR.F.TotAssets(IncludeSpl=Yes)"]
df2 = rd.get_data(
universe = syntax,
fields = TSfields,
parameters = {'Scale': 0, 'SDate': "1989-01-01",'EDate': "2022-06-05", 'FRQ': 'FY', 'Curn': 'USD'},
)
df2.rename(columns = {'Instrument':'#'},
inplace = True)
df2.loc[-1] = df2.columns.to_list()
df2 = df2.sort_index().reset_index(drop=True)
df2.columns = ["ticker","PEDate","assets"]
print(df2)
df2.to_csv("tob_shutoff_TSraw.csv", date_format='%Y-%m-%d', index=False)
print(df2['PEDate'])
Best Answer
-
Hi @LRE42
Can you confirm the version of the refinitiv.data library you are using?
I was able to replicate using the latest version (1.0.0b13).
Can you try downgrading to version (refinitiv-data==1.0.0b9)? I had better success with this version. In the meantime, I will report the behavior to the development team.
thanks.
0
Answers
-
Hi Nick -- Thanks. i am using 1.0.0b13. I have used the eikon package instead (with just a few text edits), and it is working for me now as expected. But I'm glad to know the development team will get the error message and hopefully improve the functionality.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 616 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 556 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 652 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛