manually changing dataframe for catalog #580
-
Hi! I'm trying to manually change the dataframe for an
intake_esm.show_versions()
INSTALLED VERSIONS
------------------
cftime: 1.6.2
dask: 2022.9.2
fastprogress: 0.2.7
fsspec: 2021.10.0
gcsfs: 2021.07.0
intake: 0.6.7
intake_esm: 2022.9.18
netCDF4: 1.6.2
pandas: 1.5.3
requests: 2.28.2
s3fs: 2022.8.2
xarray: 2022.9.0
zarr: 2.13.2 The Issue import intake
import dask
url = "https://storage.googleapis.com/cmip6/pangeo-cmip6.json"
col = intake.open_esm_datastore(url)
scenarios = ["ssp370", "piControl", "historical"] # set desired scenarios
var_name = 'tos'
time_step = ['Oday']
query = dict(experiment_id = scenarios,
variable_id=var_name,
table_id = time_step,
member_id = 'r1i1p1f1'
)
cat = col.search(require_all_on="source_id", **query)
correct_order = list(cat.df.columns)
new_df = cat.df.groupby(['source_id','experiment_id']).first().reset_index()[correct_order]
cat.df= new_df Yields the error: ---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 19
17 correct_order = list(cat.df.columns)
18 new_df = cat.df.groupby(['source_id','experiment_id']).first().reset_index()[correct_order]
---> 19 cat.df= new_df
AttributeError: can't set attribute Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@jgiguereCC, thank you for putting together this reproducible issue :) Try the following instead, In [6]: cat.esmcat._df = new_df |
Beta Was this translation helpful? Give feedback.
-
that seems to work! thanks! |
Beta Was this translation helpful? Give feedback.
@jgiguereCC, thank you for putting together this reproducible issue :)
Try the following instead,