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

DataFrame.itertuples accepts index, name kwargs #4593

Merged

Conversation

Projects
None yet
2 participants
@danodonovan
Copy link
Contributor

commented Mar 14, 2019

  • Tests added / passed
  • Passes flake8 dask

The dask documentation http://docs.dask.org/en/latest/dataframe-api.html#dask.dataframe.DataFrame.itertuples suggests that DataFrame.itertuples accepts kwargs index and name like pandas dataframes.

This PR makes one small change to add this functionality, and adds the appropriate tests.

@danodonovan

This comment has been minimized.

Copy link
Contributor Author

commented Mar 14, 2019

@@ -2990,10 +2990,10 @@ def iterrows(self):
yield row

@derived_from(pd.DataFrame)
def itertuples(self):
def itertuples(self, **kwargs):

This comment has been minimized.

Copy link
@TomAugspurger

TomAugspurger Mar 14, 2019

Member

Can you make this match the signature of pandas? (index=True, name='Pandas')?

Show resolved Hide resolved dask/dataframe/tests/test_dataframe.py
@TomAugspurger

This comment has been minimized.

Copy link
Member

commented Mar 14, 2019

@mrocklin do you think this will cause any issues with distributed, since we'll be sending around namedtuples? I think we'll be ok since we use cloudpickle, but want to verify.

@danodonovan

This comment has been minimized.

Copy link
Contributor Author

commented Mar 14, 2019

I think the current behaviour would be to send around namedtuples - (as that's the default pandas implementation with name='Pandas'). This change would be to additionally send around regular tuples (when name=None).

@TomAugspurger

This comment has been minimized.

Copy link
Member

commented Mar 14, 2019

Ah, you're correct. In that case, Thanks @danodonovan.

@TomAugspurger TomAugspurger merged commit e594824 into dask:master Mar 14, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@danodonovan danodonovan deleted the danodonovan:dataframe-itertuples-parameters branch Mar 14, 2019

jorge-pessoa pushed a commit to jorge-pessoa/dask that referenced this pull request May 14, 2019

DataFrame.itertuples accepts index, name kwargs (dask#4593)
* DataFrame.itertuples accepts index, name kwargs

* Match pandas itertuples signature

* Assert tuple types match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.