lundi 21 août 2017

Python in operator doesn't work [on hold]

I'm checking if a zip code value exists in the list using in operator. However "in" check fails, although the value does exist in the list:

def scrapForZipVsState():
    existingZipsDF = pd.read_csv("crosswalk.csv", error_bad_lines=False, sep=";", header=None, usecols=[0,1])

    existingZips = list(existingZipsDF[0])
    print(existingZips)
    for zp in zips: 
        cleanZip = str(zp).split('-', 1)[0]
        print(cleanZip)
        if str(cleanZip) in list(existingZips):
            print("Skipping...")
            continue

And the log is:

[94163, 28255, 94163, 28255, 10017, 94163, 28255, 10017, 78288, 15129, 23285, 94163]
94163
...

What might be an issue here? thanks

Aucun commentaire:

Enregistrer un commentaire