Skip to content

Add axes property to DataFrame and Series#8069

Merged
jrbourbeau merged 4 commits intodask:mainfrom
dotNomad:add-axes
Aug 27, 2021
Merged

Add axes property to DataFrame and Series#8069
jrbourbeau merged 4 commits intodask:mainfrom
dotNomad:add-axes

Conversation

@dotNomad
Copy link
Copy Markdown
Contributor

For Issue #1259

  • Tests added / passed
  • Passes black dask / flake8 dask / isort dask

@GPUtester
Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@jsignell
Copy link
Copy Markdown
Member

@dask/gpu can someone trigger CI?

@pentschev
Copy link
Copy Markdown
Member

ok to test

Copy link
Copy Markdown
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks @dotNomad

def test_series_axes():
ps = pd.Series(["abcde"])
ds = dd.from_pandas(ps, npartitions=2)
assert len(ds.axes) == 1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's compare to the expected len from pandas instead. What you already have seems right, but comparing to pandas directly will be more clear to readers and robust to potential future changes

Suggested change
assert len(ds.axes) == 1
assert len(ds.axes) == len(ps.axes)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion 👍
Adjusted in 6dd6faf

def test_axes():
pdf = pd.DataFrame({"col1": [1, 2], "col2": [3, 4]})
df = dd.from_pandas(pdf, npartitions=2)
assert len(df) == 2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similar comment here

Suggested change
assert len(df) == 2
assert len(df.axes) == len(pdf.axes)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adjusted in 6dd6faf

Copy link
Copy Markdown
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks @dotNomad! This is in

Also, I noticed this is your first code contribution to this repository. Welcome!

@jrbourbeau jrbourbeau merged commit fb4e90a into dask:main Aug 27, 2021
@dotNomad dotNomad deleted the add-axes branch August 27, 2021 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants