From 6b52253fed132084d08d2798b8f0241718e3ae1d Mon Sep 17 00:00:00 2001 From: John DeSanto <202220+jdesanto@users.noreply.github.com> Date: Tue, 19 Sep 2023 10:40:50 -0700 Subject: [PATCH] Moved geopandas file load out of constructor --- ads/dataset/sampled_dataset.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ads/dataset/sampled_dataset.py b/ads/dataset/sampled_dataset.py index 665957ebd..8d420c1c7 100644 --- a/ads/dataset/sampled_dataset.py +++ b/ads/dataset/sampled_dataset.py @@ -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() @@ -706,6 +703,11 @@ def _visualize_feature_distribution(self, html_widget): gdf = geopandas.GeoDataFrame( df, geometry=geopandas.points_from_xy(df["lon"], df["lat"]) ) + + self.world = geopandas.read_file( + geopandas.datasets.get_path("naturalearth_lowres") + ) + self.world.plot( ax=ax, color="lightgrey", linewidth=0.5, edgecolor="white" )