symerio / pgeocode

Postal code geocoding and distance calculation
https://pgeocode.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
239 stars 58 forks source link

County Code for Naples is NA #73

Open AlessandroLorenzi opened 1 year ago

AlessandroLorenzi commented 1 year ago

Hi,

This is the data fetched from pgocode for 80030 postal code:

postal_code                                                   80030
country_code                                                     IT
place_name        Spartimento, Gallo, Cimitile, Carbonara Di Nol...
state_name                                                 Campania
state_code                                                        4
county_name                                                  Napoli
county_code                                                     NaN
community_name                                                  NaN
community_code                                                  NaN
latitude                                                  40.926694
longitude                                                 14.520376
accuracy                                                        4.0

This is the raw from GeoNames:

IT      80030   Spartimento     Campania        04      Napoli  NA                      40.891  14.4724 4
IT      80030   Gallo   Campania        04      Napoli  NA                      40.9424 14.5455 4
IT      80030   Cimitile        Campania        04      Napoli  NA                      40.9423 14.5256 4
IT      80030   Carbonara Di Nola       Campania        04      Napoli  NA                      40.8744 14.5788 4
IT      80030   Camposano       Campania        04      Napoli  NA                      40.9524 14.5299 4
IT      80030   San Vitaliano   Campania        04      Napoli  NA                      40.9244 14.4746 4
IT      80030   Castello Di Cisterna    Campania        04      Napoli  NA                      40.9159 14.4112 4
IT      80030   Mariglianella   Campania        04      Napoli  NA                      40.9296 14.437  4
IT      80030   Visciano        Campania        04      Napoli  NA                      40.9238 14.5824 4
IT      80030   Tufino  Campania        04      Napoli  NA                      40.9559 14.5657 4
IT      80030   Liveri  Campania        04      Napoli  NA                      40.9041 14.5654 4
IT      80030   San Paolo Bel Sito      Campania        04      Napoli  NA                      40.9135 14.5486 4
IT      80030   Comiziano       Campania        04      Napoli  NA                      40.9516 14.5512 4
IT      80030   Scisciano       Campania        04      Napoli  NA                      40.9066 14.4745 4
IT      80030   Roccarainola    Campania        04      Napoli  NA                      40.9725 14.5428 4
IT      80030   Schiava Campania        04      Napoli  NA                      40.9267 14.5204 3
IT      80030   Gargani Campania        04      Napoli  NA                      40.9267 14.5204 3

The data from GeoNames dataset is correct, I assume that the library is misinterpreting NA as NaN.

AlessandroLorenzi commented 1 year ago

update: in the csv "NA" is missing!

        data_path = os.path.join(STORAGE_DIR, country.upper() + ".txt")
        if os.path.exists(data_path):
            data = pd.read_csv(
                data_path, dtype={"postal_code": str}, na_values=NA_VALUES
            )
# grep 80023 ~/.cache/pgeocode/IT.tx
IT,80023,Caivano,Campania,4,Napoli,,,,40.9575,14.3059,4.0
IT,80023,Pascarola,Campania,4,Napoli,,,,40.9764,14.305,4.0
AlessandroLorenzi commented 1 year ago

hi @rth could you do a release? this feature is still not in latest version published

rth commented 1 year ago

It's released now @AlessandroLorenzi thanks for the reminder.