• Bug#1053944: q2-types: test failure with pandas 2.1 (Was: Bug#1044068:

    From Andreas Tille@21:1/5 to All on Fri Feb 16 22:10:01 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
    (