Skip to content

Commit

Permalink
pandas lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gboeing committed Dec 7, 2023
1 parent a86e56b commit 4ce9589
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions osmnx/osm_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def _save_graph_xml(
)

# rename columns per osm specification
gdf_nodes.rename(columns={"x": "lon", "y": "lat"}, inplace=True)
gdf_nodes = gdf_nodes.rename(columns={"x": "lon", "y": "lat"})
gdf_nodes["lon"] = gdf_nodes["lon"].round(precision)
gdf_nodes["lat"] = gdf_nodes["lat"].round(precision)
gdf_nodes = gdf_nodes.reset_index().rename(columns={"osmid": "id"})
Expand Down Expand Up @@ -464,7 +464,7 @@ def _append_edges_xml_tree(root, gdf_edges, edge_attrs, edge_tags, edge_tag_aggs
root : ElementTree.Element
XML tree with edges appended
"""
gdf_edges.reset_index(inplace=True)
gdf_edges = gdf_edges.reset_index()
if merge_edges:
for _, all_way_edges in gdf_edges.groupby("id"):
first = all_way_edges.iloc[0].dropna().astype(str)
Expand Down
4 changes: 2 additions & 2 deletions osmnx/utils_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def graph_to_gdfs(G, nodes=True, edges=True, node_geometry=True, fill_edge_geome
else:
gdf_nodes = gpd.GeoDataFrame(data, index=nodes)

gdf_nodes.index.rename("osmid", inplace=True)
gdf_nodes.index = gdf_nodes.index.rename("osmid")
utils.log("Created nodes GeoDataFrame from graph")

if edges:
Expand Down Expand Up @@ -91,7 +91,7 @@ def _make_geom(u, v, data, x=x_lookup, y=y_lookup):
gdf_edges["u"] = u
gdf_edges["v"] = v
gdf_edges["key"] = k
gdf_edges.set_index(["u", "v", "key"], inplace=True)
gdf_edges = gdf_edges.set_index(["u", "v", "key"])

utils.log("Created edges GeoDataFrame from graph")

Expand Down

0 comments on commit 4ce9589

Please sign in to comment.