geosnap: Harmonize returning nan for intensive variables

import geosnap
Loading manifest: 100%|██████████| 5/5 [00:00<00:00, 17133.59entries/s]
Loading manifest: 100%|██████████| 5/5 [00:00<00:00, 7020.93entries/s]
geosnap.__version__
'0.3.2'
sd = geosnap.Community.from_census(county_fips='06073')
/home/serge/anaconda3/envs/geosnapdev/lib/python3.7/site-packages/pyproj/crs/crs.py:53: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  return _prepare_from_string(" ".join(pjargs))
sd.gdf.head()
<div> <style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
geoid n_mexican_pop n_cuban_pop n_puerto_rican_pop n_total_housing_units n_vacant_housing_units n_occupied_housing_units n_owner_occupied_housing_units n_renter_occupied_housing_units n_white_persons ... p_irish_born_pop p_italian_born_pop p_poverty_rate_children p_poverty_rate_hispanic p_russian_born_pop p_scandanavian_born_pop p_scandanavian_pop n_total_pop_sample p_female_labor_force p_black_persons
5188 06073019000 5094.0 2.0 5.0 2326.0 184.0 2142.0 1769.0 373.0 4898911.0 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
5189 06073018700 30479.0 72.0 611.0 4819.0 50.0 4769.0 250.0 4519.0 215361577.0 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
5205 06073019101 2497.0 0.0 9.0 1497.0 154.0 1343.0 858.0 485.0 16221375.0 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
5206 06073020901 4839.0 7.0 5.0 3042.0 995.0 2047.0 1430.0 617.0 4416241.0 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
5207 06073021000 2337.0 0.0 15.0 2457.0 1154.0 1303.0 979.0 324.0 2302215.0 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

5 rows × 195 columns

</div>
extensive = ['n_total_pop', 'n_total_housing_units', 'n_vacant_housing_units']
intensive = ['median_household_income', 'p_poverty_rate']
sd.gdf['median_household_income'] = sd.gdf['median_household_income'].fillna(0)
sd.gdf['median_household_income'].isnull().sum()
0
sd.gdf['p_poverty_rate'] = sd.gdf['p_poverty_rate'].fillna(0)
sd.gdf['p_poverty_rate'].isnull().sum()
0
sd_2010 = sd.harmonize(2010,extensive_variables=extensive,
                      intensive_variables=intensive)
/home/serge/anaconda3/envs/geosnapdev/lib/python3.7/site-packages/tobler/area_weighted/area_weighted.py:249: UserWarning: Geometry is in a geographic CRS. Results from 'area' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  den = source_df["geometry"].area.values
/home/serge/anaconda3/envs/geosnapdev/lib/python3.7/site-packages/tobler/area_weighted/area_weighted.py:249: UserWarning: Geometry is in a geographic CRS. Results from 'area' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  den = source_df["geometry"].area.values
/home/serge/anaconda3/envs/geosnapdev/lib/python3.7/site-packages/tobler/area_weighted/area_weighted.py:249: UserWarning: Geometry is in a geographic CRS. Results from 'area' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  den = source_df["geometry"].area.values
sd_2010.gdf.head()
<div> <style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
geoid geometry median_household_income n_total_housing_units n_total_pop n_vacant_housing_units p_poverty_rate year
0 06073014901 POLYGON ((-117.01957 32.76373, -117.01562 32.7... NaN 1876.000000 4156.000000 131.00000 NaN 2010
1 06073000300 POLYGON ((-117.16864 32.74897, -117.16602 32.7... NaN 3046.000000 4629.000000 397.00000 NaN 2010
2 06073000800 POLYGON ((-117.14632 32.74842, -117.14250 32.7... NaN 2702.000000 3964.000000 253.00000 NaN 2010
3 06073002201 POLYGON ((-117.11577 32.75522, -117.11362 32.7... NaN 1321.000000 3989.000000 76.00000 NaN 2010
4 06073018509 POLYGON ((-117.37213 33.20012, -117.36902 33.2... NaN 1700.999899 5325.999683 171.99999 NaN 2010
</div>

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (10 by maintainers)

Commits related to this issue

Most upvoted comments

i think i see whats going on

no i just installed it from master

cd geosnap; conda env create -f environment.yml
conda activate geosnap; python setup.py install
pip uninstall tobler -y  # uninstall conda version first 
cd ../tobler
python setup.py install  # install current master