-
Notifications
You must be signed in to change notification settings - Fork 358
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
Basic support for non-string names. #1784
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks fine, but I wonder maybe if it wouldn't matter to abandon some of the features we could have supported before ??
databricks/koalas/indexes.py
Outdated
@@ -1066,7 +1064,7 @@ def drop(self, labels): | |||
>>> index.drop([1]) | |||
Int64Index([2, 3], dtype='int64') | |||
""" | |||
if not isinstance(labels, (tuple, list)): | |||
if not is_list_like(labels): # TODO: tuple? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe we don't need to consider tuple
here because Index
cannot have tuple
value in Koalas anyway ??
>>> ks.Index([(1, 2), 3]) # Cannot have a tuple for Index as mixed type
Traceback (most recent call last):
...
pyarrow.lib.ArrowInvalid: Could not convert (1, 2) with type tuple: did not recognize Python value type when inferring an Arrow data type
>>> ks.Index([(1, 2), (3, 4)]) # This is not gonna be an Index but MultiIndex
MultiIndex([(1, 2),
(3, 4)],
)
Oh, but if we had any plan for supporting tuple for values, I think It's okay to remain the TODO as it is.
Let me revert some commits. Maybe we should discuss input checks separately. |
c542a3d
to
6bd0895
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good enough in terms of Basic support
!
Let's discuss the details separately.
Thanks! I'd merge this now. I'll submit PRs for each input check. |
Fixes type annotations. After ##1784, those should accept non-string tuples.
Currently names in Koalas, e.g.,
df.columns
,df.colums.names
,df.index.names
, need to be string or tuple of string, but it should allow other data types which are supported by Spark.before:
after: