Skip to content

Pytest fails on master branch #300

@consideRatio

Description

@consideRatio

There is a pytest failure in the master branch, and I'm not sure how to fix it. I concluded it occur on master with pandas=1 and pandas<1. It feels bad to make another release before this is fixed or understood.

Duplicated issue

pytest error logs

============================================= FAILURES ==============================================
_____________________________________ test_period_object_column _____________________________________

    def test_period_object_column():
        range_index = pd.period_range(start="2000", periods=10, freq="B")
        df = pd.DataFrame({"a": 5, "b": range_index}, index=range_index)
>       view = QgridWidget(df=df)

qgrid/tests/test_grid.py:240: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qgrid/grid.py:627: in __init__
    self._update_df()
qgrid/grid.py:820: in _update_df
    self._update_table(update_columns=True, fire_data_change_event=False)
qgrid/grid.py:966: in _update_table
    double_precision=self.precision)
/home/erik/anaconda3/lib/python3.7/site-packages/pandas/io/json/_json.py:85: in to_json
    indent=indent,
/home/erik/anaconda3/lib/python3.7/site-packages/pandas/io/json/_json.py:291: in __init__
    self.schema = build_table_schema(obj, index=self.index)
/home/erik/anaconda3/lib/python3.7/site-packages/pandas/io/json/_table_schema.py:253: in build_table_schema
    fields.append(convert_pandas_type_to_json_field(s))
/home/erik/anaconda3/lib/python3.7/site-packages/pandas/io/json/_table_schema.py:117: in convert_pandas_type_to_json_field
    field["freq"] = arr.freqstr
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = index
2000-01-03    2000-01-03
2000-01-04    2000-01-04
2000-01-05    2000-01-05
2000-01-06    2000-01-06
2000-01-07  ...1-11    2000-01-11
2000-01-12    2000-01-12
2000-01-13    2000-01-13
2000-01-14    2000-01-14
Name: b, dtype: period[B]
name = 'freqstr'

    def __getattr__(self, name: str):
        """After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        """
    
        # Note: obj.x will always call obj.__getattribute__('x') prior to
        # calling obj.__getattr__('x').
    
        if (
            name in self._internal_names_set
            or name in self._metadata
            or name in self._accessors
        ):
            return object.__getattribute__(self, name)
        else:
            if self._info_axis._can_hold_identifiers_and_holds_name(name):
                return self[name]
>           return object.__getattribute__(self, name)
E           AttributeError: 'Series' object has no attribute 'freqstr'

/home/erik/anaconda3/lib/python3.7/site-packages/pandas/core/generic.py:5274: AttributeError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions