Conversation
|
look ok. these may have broken things. |
|
Indeed - the refactoring - if len(types) == 0:
+ if not types:was wrong, as Have fixed up and changed the annotation |
pandas/core/dtypes/cast.py
Outdated
|
|
||
|
|
||
| def find_common_type(types: List[DtypeObj]) -> DtypeObj: | ||
| def find_common_type(types: Union[List[DtypeObj], Series]) -> DtypeObj: |
There was a problem hiding this comment.
where are we passing a Series? we shouldn't do this
There was a problem hiding this comment.
in pandas/tests/arrays/sparse/test_accessor.py::TestFrameAccessor::test_to_coo
There was a problem hiding this comment.
I'll dig deeper at the weekend
There was a problem hiding this comment.
@jreback the problem is that when we do
df = pd.DataFrame({"A": [0, 1, 0], "B": [1, 0, 0]}, dtype="Sparse[int64, 0]")
result = df.sparse.to_coo()
then, in to_coo from pandas/core/arrays/sparse/accessor.py, we have
dtype = find_common_type(self._parent.dtypes)
and so this is how we pass a Series (self._parent.dtypes is a Series).
Is there a better way to fix this than
dtype = find_common_type(self._parent.dtypes.to_list())
?
|
can you merge master ping on green |
Green, barring (probably unrelated?) travis error: |
| from scipy.sparse import coo_matrix | ||
|
|
||
| dtype = find_common_type(self._parent.dtypes) | ||
| dtype = find_common_type(self._parent.dtypes.to_list()) |
There was a problem hiding this comment.
this is because find_commont_type from pandas/core/dtypes/cast.py requires a list
|
moving off 1.2 until ready |
|
Sure, no problem (though as far as I can tell, this is ready - anything else need changing?) |
I think it was fine, just want to make sure after merge |
|
sure, have merged |
| # tzawareness compat failure, see GH#28507 | ||
| return False | ||
| elif "boolean value of NA is ambiguous" in str(err): | ||
| return False |
There was a problem hiding this comment.
i think this is for coverage
… into refactor-core-dtypes
… into refactor-core-dtypes
|
thanks @MarcoGorelli |
Some refactorings found by Sourcery https://sourcery.ai/
I've removed the ones of the kind