[Debian-med-packaging] Bug#1053944: q2-types: test failure with pandas 2.1 (Was: Bug#1044068: q2templates: FTBFS with pandas 2.0)

Andreas Tille andreas at an3as.eu
Fri Feb 16 20:56:04 GMT 2024


Control: tags -1 help

Hi again,

thanks again for your great help.  I admit I need some help for q2-types as
well.  While log in the bug report vanished you will easily find things like

  TypeError: read_csv() got an unexpected keyword argument 'squeeze'

when trying to build the package.

I've found an issue at pandas upstream[1] which inspired me to the patch

--- a/q2_types/sample_data/tests/test_transformer.py
+++ b/q2_types/sample_data/tests/test_transformer.py
@@ -28,8 +28,8 @@ class TestTransformers(TestPluginBase):
         obs = transformer(exp)

         # Squeeze equals true to return series instead of dataframe
-        obs = pd.read_csv(str(obs), sep='\t', header=0, index_col=0,
-                          squeeze=True)
+        obs = pd.read_csv(str(obs), sep='\t', header=0, index_col=0)
+        obs.squeeze("columns")

         assert_series_equal(exp, obs)

which is obviously wrong since it leads to

        # Squeeze equals true to return series instead of dataframe
        obs = pd.read_csv(str(obs), sep='\t', header=0, index_col=0)
        obs.squeeze("columns")
    
>       assert_series_equal(exp, obs)


Probably a better solution can be found at stackoverflow[2] to use
DataFrame.squeeze('columns') but I'm simply lacking an example how to use
this.

Finally this is not the only error and I would appreciate any helping hint
(patch?) to get the package ported to recent pandas.

Kind regards
    Andreas.

[1] https://github.com/pandas-dev/pandas/issues/43242
[2] https://stackoverflow.com/questions/76684141/why-am-i-getting-an-error-when-using-squeeze-keyword-in-read-csv


Am Fri, Feb 16, 2024 at 10:48:59AM +0100 schrieb s3v:
> ...
> Kind Regards

-- 
http://fam-tille.de



More information about the Debian-med-packaging mailing list