-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat(python): add to_repr
methods to DataFrame and Series
#7802
Conversation
Closes: #7732 @alexander-beedie I also added missing |
I'm trying to come up with a different name for Something like |
Yes, I agree. I think Really cool feature @ghuls. |
I am fine with changing the name, but can you explain me why it is not the actual repr? As far as I know import numpy as np
In [9]: a = np.array([[48984, 4894], [4568, 48968], [468135, 49849]])
In [10]: a.__repr__()
Out[10]: 'array([[ 48984, 4894],\n [ 4568, 48968],\n [468135, 49849]])'
In [11]: print(a.__repr__())
array([[ 48984, 4894],
[ 4568, 48968],
[468135, 49849]])
In [13]: from numpy import array
In [14]: eval(a.__repr__())
Out[14]:
array([[ 48984, 4894],
[ 4568, 48968],
[468135, 49849]]) Do you plan to find another name for |
The short version would be: if it's not what you get back from calling
The result from an object's Now, for many types it is also a good idea to make the repr usable as if you could eval/init it (and on any smaller-scale custom types I develop at work I make the effort to do so); also from the python docs: "for many types, this function makes an attempt to return a string that would yield an object with the same value when passed to eval()" (but note the use of "many", not "all", and "makes an attempt"). Objects like DataFrames (or anything else that fronts large data) don't usually return eval-style reprs because anything other than a trivial frame would return an absurdly large string, rendering it unprintable and/or less useful as the "official" representation of the given object/data. Hence Polars doesn't, Pandas doesn't, PyArrow doesn't, DB interfaces don't, etc. The general trend in these cases is to have a partial table representation that provides a useful sense of the object (its size, the schema, some data, and so on).
No - because Footnotes |
I thought that Changed name to |
90262cd
to
537952a
Compare
No description provided.