Home > Software design >  Assign dataframe head results to another dataframe
Assign dataframe head results to another dataframe

Time:06-10

Here is the scenario.

  1. Millions of data from source.

  2. I'd like to get a sample 10k records only.
    df = record.head(10000)

  3. Search the 10k records. Get the first record who's specific column is not null.

    df[~df['af_ad_id'].isnull()].head(1)

This is returning an error -- AttributeError: 'NoneType' object has no attribute 'isnull'.

CodePudding user response:

Your getting that error because df['af_ad_id'] is of type None

CodePudding user response:

Let try df[~df['af_ad_id'].isnull()][0]

  • Related