Skip to content

ARROW-1632: [Python] Permit categorical conversions in Table.to_pandas on a per-column basis - #1620

Closed
xhochy wants to merge 4 commits into
apache:masterfrom
xhochy:ARROW-1632
Closed

xhochy wants to merge 4 commits into
apache:masterfrom
xhochy:ARROW-1632

Conversation

@xhochy

@xhochy xhochy commented Feb 17, 2018

Copy link
Copy Markdown
Member

This is failing due to the first entry of the indices being uninitialised memory in the pandas series. On the C++ side, everything looks good. Would be nice if someone could have a look, I‘m out of ideas.

@xhochy

xhochy commented Feb 17, 2018

Copy link
Copy Markdown
Member Author

Foumd the problem. We did not hold a reference to the index array in the case that we did not need to copy it. Ready for review now

Comment thread cpp/src/arrow/python/arrow_to_pandas.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to use !categorical_columns.empty()?

Comment thread cpp/src/arrow/python/arrow_to_pandas.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a top level ::arrow::field function that does this? If not, then this call should use auto since Field is already mentioned in the call to make_shared.

Comment thread cpp/src/arrow/python/arrow_to_pandas.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use auto as well.

Comment thread cpp/src/arrow/python/arrow_to_pandas.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can use auto.

Comment thread python/pyarrow/includes/libarrow.pxd Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be const unordered_set[c_string]&?

Comment thread python/pyarrow/table.pxi Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this a set comprehension? It's misleading to have a Python list automatically turned into a C++ unordered_set IMO.

@wesm wesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted a couple unchecked Status and made an API note

Comment thread cpp/src/arrow/python/arrow_to_pandas.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check Status in these two lines

Comment thread cpp/src/arrow/python/arrow_to_pandas.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can also use ::arrow::field here

Comment thread cpp/src/arrow/python/arrow_to_pandas.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check Status

Comment thread cpp/src/arrow/python/arrow_to_pandas.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we might want to put categorical_columns in the Options data structure

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking at doing that but the options structure also makes sense on a per-column basis (and we use it for that) bur the column list is only useful in the Table case.

@wesm

wesm commented Feb 21, 2018

Copy link
Copy Markdown
Member

rebased

@wesm wesm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, thanks @xhochy!

@wesm wesm closed this in b2eb6ac Mar 1, 2018
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 this pull request may close these issues.

3 participants