Skip to content

Commit 9658c7b

Browse files
resolve iteritems() warnings and others (#436)
* resolve iteritems() warnings * fix more warnings * pin libpysal>=4.6.0 * change libpysal requirement in docs Co-authored-by: Martin Fleischmann <[email protected]>
1 parent a1268c2 commit 9658c7b

13 files changed

+16
-18
lines changed

ci/envs/310-dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- dask
77
- geopandas
88
- inequality
9-
- libpysal
9+
- libpysal>=4.6.0
1010
- networkx
1111
- osmnx
1212
- packaging

ci/envs/310-latest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.10
66
- geopandas
77
- inequality
8-
- libpysal
8+
- libpysal>=4.6.0
99
- mapclassify
1010
- networkx
1111
- packaging

ci/envs/38-minimal.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.8
66
- geopandas=0.8
77
- inequality
8-
- libpysal=4.2.2
8+
- libpysal=4.6.0
99
- mapclassify
1010
- networkx=2.3
1111
- numpy=1.21

ci/envs/39-latest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.9
66
- geopandas
77
- inequality
8-
- libpysal
8+
- libpysal>=4.6.0
99
- mapclassify
1010
- networkx
1111
- osmnx

docs/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Dependencies
109109
Required dependencies:
110110

111111
- `geopandas`_ (>= 0.8.0)
112-
- `libpysal`_ (>= 4.1.0)
112+
- `libpysal`_ (>= 4.6.0)
113113
- `networkx`_
114114
- `tqdm`_
115115
- `pygeos`_

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- geopandas
77
- inequality
88
- jupyter
9-
- libpysal
9+
- libpysal>=4.6.0
1010
- mapclassify
1111
- matplotlib
1212
- momepy

momepy/coins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(self, edge_gdf, angle_threshold=0):
6868
self.uv_index = range(len(self.edge_gdf.index))
6969

7070
# get line segments from edge gdf
71-
self.lines = [list(value[1].coords) for value in edge_gdf.geometry.iteritems()]
71+
self.lines = [list(value[1].coords) for value in edge_gdf.geometry.items()]
7272

7373
# split edges into line segments
7474
self._split_lines()

momepy/distribution.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def __init__(self, gdf, spatial_weights, unique_id, orientations, verbose=True):
471471

472472
# iterating over rows one by one
473473
for index, orient in tqdm(
474-
data.iteritems(), total=data.shape[0], disable=not verbose
474+
data.items(), total=data.shape[0], disable=not verbose
475475
):
476476
if index in spatial_weights.neighbors.keys():
477477
neighbours = spatial_weights.neighbors[index]
@@ -538,9 +538,7 @@ def __init__(self, gdf, spatial_weights, unique_id, verbose=True):
538538
data = gdf.set_index(unique_id).geometry
539539

540540
# iterating over rows one by one
541-
for index, geom in tqdm(
542-
data.iteritems(), total=data.shape[0], disable=not verbose
543-
):
541+
for index, geom in tqdm(data.items(), total=data.shape[0], disable=not verbose):
544542
if geom is not None and index in spatial_weights.neighbors.keys():
545543
neighbours = spatial_weights.neighbors[index]
546544
building_neighbours = data.loc[neighbours]
@@ -626,7 +624,7 @@ def __init__(
626624
results_list = []
627625

628626
# define adjacency list from lipysal
629-
adj_list = spatial_weights.to_adjlist()
627+
adj_list = spatial_weights.to_adjlist(drop_islands=True)
630628
adj_list["weight"] = (
631629
data.loc[adj_list.focal]
632630
.reset_index(drop=True)
@@ -876,7 +874,7 @@ def __init__(self, gdf, spatial_weights, unique_id, weighted=False, verbose=True
876874

877875
neighbours = []
878876
for index, geom in tqdm(
879-
gdf.set_index(unique_id).geometry.iteritems(),
877+
gdf.set_index(unique_id).geometry.items(),
880878
total=gdf.shape[0],
881879
disable=not verbose,
882880
):

momepy/diversity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ def __init__(
868868
data.geometry = data.centroid
869869

870870
for i, geom in tqdm(
871-
data.geometry.iteritems(), total=data.shape[0], disable=not verbose
871+
data.geometry.items(), total=data.shape[0], disable=not verbose
872872
):
873873
if i in spatial_weights.neighbors.keys():
874874
neighbours = spatial_weights.neighbors[i]

momepy/elements.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ def get_network_ratio(df, edges, initial_buffer=500):
923923
for name, group in grouped:
924924
ratios = group / totals.loc[name]
925925
ints_vect.append(
926-
{edg_ix[touching][item[0]]: item[1] for item in ratios.iteritems()}
926+
{edg_ix[touching][item[0]]: item[1] for item in ratios.items()}
927927
)
928928

929929
ratios = pd.Series(ints_vect, index=df.index[list(grouped.groups.keys())])

0 commit comments

Comments
 (0)