Nan appears when python uses pandas to process csv files

import pandas as pd
self.url_list=pd.read_csv (". / files/baidusearch.csv", encoding= "utf-8")

        for link in self.url_list["link"]:

            if link:
                print("")
                print(link)

print link
nan
print link
nan
print link
http://www.mikuni-sh.com.cn/

the nan here is an empty string, but I have decided to print when it is not empty, how to avoid printing nan?

Dec.02,2021

1, nan are not used to represent empty strings, just not a number .
2, Python, except for the specified values that are processed as False, are all True. For some reason, it's a rule. python.org/2/library/stdtypes.html-sharptruth-value-testing" rel=" nofollow noreferrer "> Python truth
3. If this nan is really not a number , you can process nan as ', and your code can be executed normally.
4. If you are reading data from a csv file, the nan should be a string. All you have to do is judge if Linklink links and print it again .

Menu