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 property: DataFrame.ndim, Index.ndim, MultiIndex.ndim #947

Merged
merged 5 commits into from
Oct 28, 2019

Conversation

itholic
Copy link
Contributor

@itholic itholic commented Oct 24, 2019

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.ndim.html#pandas.DataFrame.ndim

>>> df = ks.range(10)
>>> df.ndim
2

>>> df = ks.DataFrame([[1, 2], [4, 5], [7, 8]],
...                   index=['cobra', 'viper', 'sidewinder'],
...                   columns=['max_speed', 'shield'])
>>> df.ndim
2

@codecov-io
Copy link

codecov-io commented Oct 24, 2019

Codecov Report

Merging #947 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #947      +/-   ##
==========================================
+ Coverage   94.51%   94.53%   +0.02%     
==========================================
  Files          34       34              
  Lines        6449     6464      +15     
==========================================
+ Hits         6095     6111      +16     
+ Misses        354      353       -1
Impacted Files Coverage Δ
databricks/koalas/series.py 96.22% <ø> (+0.22%) ⬆️
databricks/koalas/missing/indexes.py 100% <ø> (ø) ⬆️
databricks/koalas/missing/frame.py 100% <ø> (ø) ⬆️
databricks/koalas/base.py 94.9% <100%> (+0.06%) ⬆️
databricks/koalas/frame.py 96.03% <100%> (ø) ⬆️
databricks/koalas/missing/series.py 100% <0%> (ø) ⬆️

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 caac367...918e89a. Read the comment docs.

@ueshin
Copy link
Collaborator

ueshin commented Oct 24, 2019

@itholic Shall we also add Series.ndim and Index.ndim here?

@itholic
Copy link
Contributor Author

itholic commented Oct 24, 2019

@ueshin

Thanks for the comment!

i think Series.ndim is already existing.

>>> s
NaN    3.0
NaN    1.0
1.0    2.0
2.0    3.0
3.0    4.0
4.0    NaN
Name: 0, dtype: float64
>>> s.ndim
1

then am i going to only add index.ndim here is okay?

@itholic itholic changed the title Add property: DataFrame.ndim Add property: DataFrame.ndim, Index.ndim, MultiIndex.ndim Oct 24, 2019
>>> s.index.ndim
1
"""
return 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should move this to IndexOpsMixin and remove this in Series?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ueshin Thanks for the review!

oh i see. i just rearranged them.

@softagram-bot
Copy link

Softagram Impact Report for pull/947 (head commit: 918e89a)

⭐ Change Overview

Showing the changed files, dependency changes and the impact - click for full size
(Open in Softagram Desktop for full details)

💡 Insights

  • Co-change Alert: You modified frame.py. Often test_dataframe.py (koalas/tests) is modified at the same time.

📄 Full report

Impact Report explained. Give feedback on this report to [email protected]

Copy link
Collaborator

@ueshin ueshin left a comment

Choose a reason for hiding this comment

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

LGTM, pending tests.

@HyukjinKwon HyukjinKwon merged commit 506ae16 into databricks:master Oct 28, 2019
@itholic itholic deleted the f_ndim branch November 6, 2019 05:30
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.

5 participants