Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytest fails on master branch #300

Open
consideRatio opened this issue Mar 19, 2020 · 2 comments · Fixed by #301
Open

Pytest fails on master branch #300

consideRatio opened this issue Mar 19, 2020 · 2 comments · Fixed by #301

Comments

@consideRatio
Copy link
Contributor

consideRatio commented Mar 19, 2020

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
@gerrymanoim
Copy link
Contributor

The underlying issue is pandas-dev/pandas#31917, which we didn't have the bandwidth at the time to tackle (or patch our vendored version, which I'd like to get rid of anyway).

Looks like someone started some work on it: pandas-dev/pandas#32665.

@consideRatio
Copy link
Contributor Author

Woops! I mistakenly made this issue close by writing in the pr that got merged that this needed to be understood or fixed pre-release, i didnt mean my pr fixed this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants