diff --git a/streamz/dataframe/core.py b/streamz/dataframe/core.py index c0fb9a82..b8791b81 100644 --- a/streamz/dataframe/core.py +++ b/streamz/dataframe/core.py @@ -245,7 +245,7 @@ def __dir__(self): o = set(dir(type(self))) o.update(self.__dict__) o.update(c for c in self.columns - if (isinstance(c, pd.compat.string_types) and pd.compat.isidentifier(c))) + if (isinstance(c, str) and c.isidentifier())) return list(o) def assign(self, **kwargs): diff --git a/streamz/dataframe/tests/test_dataframes.py b/streamz/dataframe/tests/test_dataframes.py index 649e9064..67a04ec5 100644 --- a/streamz/dataframe/tests/test_dataframes.py +++ b/streamz/dataframe/tests/test_dataframes.py @@ -1007,3 +1007,10 @@ def test_windowed_groupby_aggs_with_start_state(stream): stream.emit(df) out_df1 = pd.DataFrame({'name':['Alice', 'Bob', 'Linda', 'Tom'], 'amount':[50.0, 550.0, 100.0, 150.0]}) assert_eq(output1[-1][1].reset_index(), out_df1) + + +def test_dir(stream): + example = pd.DataFrame({'name': [], 'amount': []}) + sdf = DataFrame(stream, example=example) + assert 'name' in dir(sdf) + assert 'amount' in dir(sdf)