question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Harmonize returning nan for intensive variables

See original GitHub issue
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>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
knaaptimecommented, Aug 13, 2020

i think i see whats going on

1reaction
knaaptimecommented, Aug 13, 2020

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do variable in an inner function return nan when there is ...
This is due to hoisting. The declaration of a in the inner function is hoisted to the top of the function, overriding the...
Read more >
GCE Data Toolbox for MATLAB - GCE-LTER
Added functions and a GUI dialog for shifting date/time values forward or ... Fixed a bug in plotting/plotdata.m that returned an error when...
Read more >
The Case of Capital Market Regulation - Harvard DASH
The research design is simple: I examine four issue areas of international fi nance that illustrate the combinations of values on the key...
Read more >
SciPy Reference Guide
which defines a function of two scalar variables and returns a scalar result. The class vectorize can be used to “vectorize.
Read more >
Agama reference arXiv:1802.08255v2 [astro-ph.IM] 11 Dec 2019
Various methods return the values converted to a particular type (number, string or boolean) or set/replace values.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found