TST: Fix tests for pandas 3 NA/readonly behavior - #333
Conversation
abb6a73 to
cfb1918
Compare
| _series_values = pd.Series.values | ||
| pd.Series.values = property(lambda self: self.to_numpy(copy=True)) | ||
| try: | ||
| dframe = xtg_well.get_zonation_points(top_prefix="", use_undef=True).copy() | ||
| finally: | ||
| pd.Series.values = _series_values |
There was a problem hiding this comment.
I'm not totally sure about this. Is this basically working around xtgeo not being up-to-date with pandas? If that is the case, maybe it's more prudent to pin it (or release a patch version of xtgeo with pandas pinned)?
There was a problem hiding this comment.
yes, this is a hack due to xtgeo not up to date with pandas 3. i mean it's easy just to pin pandas, but do we want to update xtgeo to pandas 3 or it doesn't matter and too much work (may turn out not so much work)?
There was a problem hiding this comment.
I'm releasing a new version of xtgeo with a pinned pandas. I propose we revert this particular change and just take in the test update to work with pandas 3.
There's not a big rush to update xtgeo to pandas 3 and it seems to affect mostly wells, which @jcrivenaes is working on right now, so there's double messiness in adapting to pandas 3. It's typical in Komodo that when a major version of a major package like this is updated it may be many months before its taken into Komodo (for numpy 2 and pandas 2 it was almost a year)
| assert {"TOP", "MID", "Below_Low_reek"} == set( | ||
| pdf.dataframe["ZONE"].dropna().unique() | ||
| ) | ||
|
|
||
| assert {"SAND", "SHALE"} == { | ||
| x for x in list(pdf.dataframe["FACIES"].unique()) if x is not None | ||
| } | ||
| assert {"SAND", "SHALE"} == set(pdf.dataframe["FACIES"].dropna().unique()) |
There was a problem hiding this comment.
this fix works for pandas 2 and 3
Resolves #331