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

Added the note of class DataFrame #44719

Closed
wants to merge 2 commits into from
Closed

Conversation

YeahNew
Copy link

@YeahNew YeahNew commented Dec 2, 2021

Added the note of class DataFrame, if the data type is torch.Tensor when creating DataFrame, it should be converted to Numpy Array for better performance.
More More detailed description in #44616.
Originally, the judgment was added directly in the init method of DataFrame: whether data is torch.Tensor
if isinstance(data,torch.Tensor):
data = data.numpy()
This can solve the time-consuming problem of DataFrame (tensor), but need to import torch, which may affect other uses of pandas, so it is more appropriate to add an explanation in the class comment.

@pep8speaks
Copy link

pep8speaks commented Dec 2, 2021

Hello @YeahNew! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-12-02 07:36:46 UTC

@@ -472,7 +472,9 @@ class DataFrame(NDFrame, OpsMixin):
data : ndarray (structured or homogeneous), Iterable, dict, or DataFrame
Dict can contain Series, arrays, constants, dataclass or list-like objects. If
data is a dict, column order follows insertion-order. If a dict contains Series
which have an index defined, it is aligned by its index.
which have an index defined, it is aligned by its index.For best performance,
Copy link
Contributor

Choose a reason for hiding this comment

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

well the problem here is an object that doesn't object the array protocol.

@jreback jreback added the Docs label Dec 5, 2021
@jreback jreback added this to the No action milestone Dec 5, 2021
@jreback
Copy link
Contributor

jreback commented Dec 5, 2021

closing as won't fix. I don't find this a useful doc addition; discussed in the original issue.

@jreback jreback closed this Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants