Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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.dropna
df = df[Local Authority] != ''
df = df.[Local Authority] != '<NA>'
And others but keep getting errors or the values remain.
Table below is an example of what I am trying to remove.
Solved! Go to Solution.
Hi @DLROLLINGS
@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.
Hi @DLROLLINGS
@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.
Hi. That <NA> doesn't look like a traditional nan that can be droped with the functions, it just looks like regular text. Have you tried to replace it? Somethig like replacing that for real none value:
df['Local Authority'] = df['Local Authority'].replace('<NA>', None)
I haven't tested but I think that might work. If you have more <NA> in other columns you can write the same code without the columns at df.
I hope that helps,
Happy to help!