Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved geopandas file load out of constructor #337

Merged
merged 4 commits into from
Sep 21, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ads/dataset/sampled_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ def __init__(
self.correlation = None
self.feature_dist_html_dict = {}
self.feature_types = metadata if metadata is not None else {}
self.world = geopandas.read_file(
geopandas.datasets.get_path("naturalearth_lowres")
)

self.numeric_columns = self.sampled_df.select_dtypes(
utils.numeric_pandas_dtypes()
Expand Down Expand Up @@ -706,6 +703,12 @@ def _visualize_feature_distribution(self, html_widget):
gdf = geopandas.GeoDataFrame(
df, geometry=geopandas.points_from_xy(df["lon"], df["lat"])
)

if not hasattr(self, "world"):
jdesanto marked this conversation as resolved.
Show resolved Hide resolved
self.world = geopandas.read_file(
geopandas.datasets.get_path("naturalearth_lowres")
)

self.world.plot(
ax=ax, color="lightgrey", linewidth=0.5, edgecolor="white"
)
Expand Down
Loading