-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: empty series not printing name in repr (#4651) #5335
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
Conversation
@jtratner this ok I think? (I can rebase on merge) |
needs to check if it has a name, no? something like: attrs = ", ".join("%s: %s" % (attr, val) for attr, val in [('dtype', self.dtype), ('name', self.name)] if val is not None)
return "Series([], %s)" % attrs Also, that will eventually make it easier to handle metadata if we want (I guess) |
well, these are always defined on series, so I think its ok (name could be None of course) |
Right, but it doesn't show it in normal Series repr if None: In [2]: ser = pd.Series([1, 2])
In [3]: ser
Out[3]:
0 1
1 2
dtype: int64
In [4]: ser.name = "apple"
In [5]: ser
Out[5]:
0 1
1 2
Name: apple, dtype: int64 |
so empty series repr would be: ser = pd.Series([], dtype=object)
ser
Series([], dtype=object)
ser.name = "apple"
Series([], name="apple", dtype=object) should fix the ordering that I posted there though. Also, I prefer to put dtype in quotes so you can always copy paste, so that would be a good addition (don't do |
@jtratner this look ok to me.....I understand you want dtype in quotes, but that is a big change (as its not done elsewhere) |
Not a big deal to me either way - and generally you're not copy/pasting |
@goyodiaz can you rebase ? |
I think we omit name if it is
|
I will try to look at this tomorrow. |
BUG: empty series not printing name in repr (#4651)
thanks! |
Implemented as suggested in #4651