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

question

Upvotes
Accepted
26 3 6 7

How to eliminate empty rows when using Get_Data?

I want to remove rows where Period End Date is null for the past 20 years.

df, err = ek.get_data(['GOOGL.O', 'MSFT.O', 'FB.O', 'AMZN.O', 'TWTR.K'], 
                      ['TR.TotalRevenue.PeriodEndDate', 'TR.TotalRevenue', 'TR.EBITDAActValue', 'TR.EBITActValue'],
                      {'Scale': 6, 'SDate': -20, 'EDate': 0, 'FRQ': 'FY', 'Curn': 'USD'} )
eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
39.4k 77 11 27

Use pandas replace and dropna methods.

import numpy as np
df['Period End Date'].replace('', np.nan, inplace=True)
df.dropna(subset=['Period End Date'], inplace=True)
df
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.