We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
df1 = pd.DataFrame({"a": list("ABCD"), "b": [1,2,3,4]}) df2 = pd.DataFrame({"a": list("BCDF"), "b": [1,2,3,4]}) df1["c"] = df1["a"].astype("category") df2["c"] = df2["a"].astype("category") pd.merge(df1, df2, on=["c"], how="outer")
Results in:
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-97-42d4959051b3> in <module>() 3 df1["c"] = df1["a"].astype("category") 4 df2["c"] = df2["a"].astype("category") ----> 5 pd.merge(df1, df2, on=["c"], how="outer") C:\portabel\miniconda\envs\sc\lib\site-packages\pandas\tools\merge.pyc in merge(left, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, copy) 36 right_index=right_index, sort=sort, suffixes=suffixes, 37 copy=copy) ---> 38 return op.get_result() 39 if __debug__: 40 merge.__doc__ = _merge_doc % '\nleft : DataFrame' C:\portabel\miniconda\envs\sc\lib\site-packages\pandas\tools\merge.pyc in get_result(self) 203 result = typ(result_data).__finalize__(self, method='merge') 204 --> 205 self._maybe_add_join_keys(result, left_indexer, right_indexer) 206 207 return result C:\portabel\miniconda\envs\sc\lib\site-packages\pandas\tools\merge.pyc in _maybe_add_join_keys(self, result, left_indexer, right_indexer) 228 key_col.put( 229 na_indexer, com.take_1d(self.right_join_keys[i], --> 230 right_na_indexer)) 231 elif name in self.right: 232 na_indexer = (right_indexer == -1).nonzero()[0] C:\portabel\miniconda\envs\sc\lib\site-packages\pandas\core\common.pyc in take_nd(arr, indexer, axis, out, fill_value, mask_info, allow_fill) 829 out_shape[axis] = len(indexer) 830 out_shape = tuple(out_shape) --> 831 if arr.flags.f_contiguous and axis == arr.ndim - 1: 832 # minor tweak that can make an order-of-magnitude difference 833 # for dataframes initialized directly from 2-d ndarrays AttributeError: 'Categorical' object has no attribute 'flags'
pd.__version__ '0.16.2'
The text was updated successfully, but these errors were encountered:
Should Categorical gain a flags property?
flags
Sorry, something went wrong.
dupe of #10324
fixed in #10464
No branches or pull requests
Results in:
The text was updated successfully, but these errors were encountered: