Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Removed <NA> from dataframe

Hi all   I am new to python and I am looking at the regression modelling, I am trying to find out how I can remove the <NA> from the Local Authority column in python.   I have tried    df = df....
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous 

     

    ibarrau Thanks for your sharing!

     

    After testing, I offer an alternative approach:

     

    local_authority_index = 1 #The number here is determined by the column where your <NA> is located.
    for row in df[1:]:
        row[localauthority_index] = None

     

    Here is the result:

     

    Regards,

    Nono Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.