Skip to content
Advertisement

Python skip empty cells

I want to be able to search through my dataframe and skip cells that are blank. However, when i read in the DF it reads the blanks as “nan”

DF1

JavaScript

I want to be able to filter through Address1, Street and Town. If there is text inside of those columns I want to add a “|” at the start but if there is no text inside of the column it skips that cell and doesn’t add the “|”

Desired Result

JavaScript

Advertisement

Answer

Something like this?

JavaScript

Which prints:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement