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

@danodonovan
Copy link
Contributor

@danodonovan danodonovan 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
Copy link
Contributor Author

@danodonovan danodonovan commented Mar 14, 2019

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

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

@TomAugspurger TomAugspurger Mar 14, 2019

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

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

@TomAugspurger TomAugspurger 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
Copy link
Contributor Author

@danodonovan danodonovan 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
Copy link
Member

@TomAugspurger TomAugspurger 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
@danodonovan danodonovan deleted the dataframe-itertuples-parameters branch Mar 14, 2019
jorge-pessoa pushed a commit to jorge-pessoa/dask that referenced this issue May 14, 2019
* 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
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants