Skip to content

Commit

Permalink
keep index
Browse files Browse the repository at this point in the history
  • Loading branch information
knaaptime committed Sep 11, 2023
1 parent ce6fcb9 commit c2d4163
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tobler/area_weighted/area_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"""

import numpy as np
import os

import geopandas as gpd
from scipy.sparse import diags, coo_matrix
import numpy as np
import pandas as pd
import os
from scipy.sparse import coo_matrix, diags

from tobler.util.util import _check_crs, _nan_check, _inf_check
from tobler.util.util import _check_crs, _inf_check, _nan_check


def _chunk_dfs(geoms_to_chunk, geoms_full, n_jobs):
Expand Down Expand Up @@ -212,7 +213,7 @@ def _area_interpolate_binning(
spatial_index="auto",
n_jobs=1,
categorical_variables=None,
categorical_frequency=True
categorical_frequency=True,
):
"""
Area interpolation for extensive, intensive and categorical variables.
Expand Down Expand Up @@ -376,4 +377,5 @@ def _area_interpolate_binning(
df = pd.concat(dfs, axis=1)
df["geometry"] = target_df[target_df.geometry.name].reset_index(drop=True)
df = gpd.GeoDataFrame(df.replace(np.inf, np.nan))
return df

return df.set_index(target_df.index)

0 comments on commit c2d4163

Please sign in to comment.