For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
26 3 3 6

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-apipythonworkspaceworkspace-data-apirefinitiv-dataplatform-eikon
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

Upvotes
Accepted
39.3k 76 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.