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

Add Int64Index, Float64Index, DatetimeIndex. #2025

Merged
merged 5 commits into from
Feb 2, 2021

Conversation

ueshin
Copy link
Collaborator

@ueshin ueshin commented Jan 29, 2021

Adds Int64Index, Float64Index, and DatetimeIndex as a placeholder.
We should still add specific attributes and methods in the following PRs.

Before:

>>> kdf = ks.DataFrame([1,2,3])
>>> type(kdf.index)
<class 'databricks.koalas.indexes.Index'>

After:

>>> type(kdf.index)
<class 'databricks.koalas.indexes.numeric.Int64Index'>

@codecov-io
Copy link

codecov-io commented Jan 29, 2021

Codecov Report

Merging #2025 (fa7c5cb) into master (885fdfc) will increase coverage by 0.03%.
The diff coverage is 96.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2025      +/-   ##
==========================================
+ Coverage   94.61%   94.64%   +0.03%     
==========================================
  Files          50       54       +4     
  Lines       11263    11393     +130     
==========================================
+ Hits        10656    10783     +127     
- Misses        607      610       +3     
Impacted Files Coverage Δ
databricks/koalas/internal.py 96.09% <87.50%> (-0.51%) ⬇️
databricks/koalas/namespace.py 84.41% <92.30%> (+0.21%) ⬆️
databricks/koalas/indexes/multi.py 95.80% <95.80%> (ø)
databricks/koalas/__init__.py 91.04% <100.00%> (+0.41%) ⬆️
databricks/koalas/frame.py 96.61% <100.00%> (-0.01%) ⬇️
databricks/koalas/indexes/__init__.py 100.00% <100.00%> (ø)
databricks/koalas/indexes/base.py 97.43% <100.00%> (ø)
databricks/koalas/indexes/datetimes.py 100.00% <100.00%> (ø)
databricks/koalas/indexes/numeric.py 100.00% <100.00%> (ø)
databricks/koalas/missing/indexes.py 100.00% <100.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8e2924...fa7c5cb. Read the comment docs.


pass


Copy link
Contributor

Choose a reason for hiding this comment

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

May I ask for the reason why we don't support UInt64Index as https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.UInt64Index.html?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because Koalas doesn't support unsigned types.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it! Thanks!

return self.spark_frame.select(self.spark_column_for(label)).columns[0]

def spark_column_for(self, label: Tuple):
def spark_column_for(self, label: Tuple) -> spark.Column:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice refactoring!

@xinrong-meng
Copy link
Contributor

It might be helpful we add some code examples in the PR description to explain what changes are introduced by this PR, for example,

Before:

>>> kdf = ks.DataFrame([1,2,3])
>>> type(kdf.index)
<class 'databricks.koalas.indexes.Index'>

After:

>>> type(kdf.index)
<class 'databricks.koalas.indexes.numeric.Int64Index'>

@xinrong-meng
Copy link
Contributor

LGTM! Thank you for doing this!

@ueshin ueshin requested a review from xinrong-meng February 1, 2021 23:23
@HyukjinKwon HyukjinKwon merged commit c023792 into databricks:master Feb 2, 2021
@ueshin ueshin deleted the indexes branch February 2, 2021 18:52
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.

4 participants