[Python] Using pyzipcodes to create a States column from Zip Code column

Discussão em 'Python' iniciado por Stack, Fevereiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    I have a dataframe called df1. It includes a zip code column (ie., includes zip codes) and I want to use the pyzipcodes library to create a new column called state, and map the zip codes to states. Does anyone have an idea how to call on and use the pyzipcodes and achieve this task?

    I was able to get entries in the state could that look like "ZipCode(zip='85711', city='Tucson', state='AZ'..." but I just want to extract the relevant state with the zip code.

    Continue reading...

Compartilhe esta Página