0

I have this code in Geopandas in a jupyter notebook

import geopandas as gpd

gdf = gpd.read_file("adm4.shp")
gdf['coordinates'] = gdf.geometry.apply(lambda x: (x.centroid.y, x.centroid.x))

df['coordinates'] = list(zip(df.latitude_geopy, df.longitude_geopy))

joined = gpd.sjoin(gdf, df, how="inner", op='contains', lsuffix='left', rsuffix='right')

It prints the entire index out:

enter image description here

How can I avoid that ?

Derek O
  • 16,770
  • 4
  • 24
  • 43
Simon GIS
  • 1,045
  • 2
  • 18
  • 37
  • 2
    Try putting a semicolon at the end of your lines – Derek O Feb 23 '23 at 07:03
  • 1
    This looks like logging. This certainly doesn’t happen for me. What version of geopandas are you using? And are you also using the logging module? How is it configured? – Michael Delgado Feb 23 '23 at 07:18
  • I tried the semicolon dint worked. Geopandas 0.12.2. No I'm not using the logging module, Should I? – Simon GIS Feb 23 '23 at 11:04
  • Assuming you were stuck with this and wanted it to go away (ideally finding why you have it when others say it shouldn't be there seems better, but anyhoo..), there's other tricks to suppress output. (The semi-colon trick mentioned already only ceases the return of the object that would be on the last line if the semi-colon isn't there. That's not the issue here, and so it doesn't help.) Depending on what channel or level is the source, it may be a simple as putting `%%capture` as the first line of this cell. Since you didn' t provide an minimal reproducible example, I cannot test. – Wayne Feb 23 '23 at 16:43
  • If that doesn't help, it is C-level, then see my comment [here](https://stackoverflow.com/questions/72183869/disabling-warning-in-jupyter-notebook-does-not-work-for-numpy#comment127545764_72183869). – Wayne Feb 23 '23 at 16:45
  • How did you install geopandas and proj? – Michael Delgado Feb 24 '23 at 05:38

0 Answers0