intake / intake-esm

An intake plugin for parsing an Earth System Model (ESM) catalog and loading assets into xarray datasets.
https://intake-esm.readthedocs.io
Apache License 2.0
130 stars 42 forks source link

Future warning for applymap deprecation #629

Closed lee1043 closed 7 months ago

lee1043 commented 9 months ago

Description

Future warning message popping up as below. I don't think it disables any capability at the moment but I am leaving this as a heads up for potential future update.

/Users/lee1043/mambaforge/envs/intake-esm/lib/python3.11/site-packages/intake_esm/cat.py:270: FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.
  .applymap(type)

What I Did

I was following the PANGEO intake example

import intake                                                                                                                                                                                                    
cat_url = "https://storage.googleapis.com/cmip6/pangeo-cmip6.json"
col = intake.open_esm_datastore(cat_url)

Version information: output of intake_esm.show_versions()

Paste the output of `intake_esm.show_versions()` here: ```python import intake_esm intake_esm.show_versions() ``` ```python INSTALLED VERSIONS ------------------ cftime: 1.6.2 dask: 2023.9.0 fastprogress: 1.0.3 fsspec: 2023.9.0 gcsfs: None intake: 0.7.0 intake_esm: 2023.7.7 netCDF4: 1.6.4 pandas: 2.1.0 requests: 2.31.0 s3fs: None xarray: 2023.8.0 zarr: 2.16.1 ```
mgrover1 commented 9 months ago

Thanks for the heads up @lee1043 - it appears this is a change in pandas 2.1.0 https://pandas.pydata.org/docs/whatsnew/v2.1.0.html#new-dataframe-map-method-and-support-for-extensionarrays

I think we can hold off on making the change until pandas decides when they plan to remove this... if we use .map() instead, it will break on versions earlier than 2.1.0.