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

Provide ability to reset index and time index on DataTable via method call #213

Open
thehomebrewnerd opened this issue Oct 7, 2020 · 3 comments
Labels
enhancement Improvement to an existing feature

Comments

@thehomebrewnerd
Copy link
Contributor

Currently if an index or time index is set on a DataTable they can be reset by calling dt.index = None or dt.time_index = None. However, this modifies the existing DataTable in place.

If we attempt to call dt.set_index(None) to reset the index, an error is raised. We should either update the existing set_index and set_time_index methods to allow a None value which will reset the index, or add new reset_index and reset_time_index methods.

To be most consistent with pandas, the approach should be to create new reset_index and reset_time_index methods on DataTable which return a new DataTable object with the index cleared.

New tests should also be added to test these methods.

@thehomebrewnerd thehomebrewnerd added the enhancement Improvement to an existing feature label Oct 7, 2020
@tyler3991
Copy link

we should implement this after #483. Ice boxing for now.

@thehomebrewnerd
Copy link
Contributor Author

With the accessor approach calling df.ww.set_index(None) or df.ww.set_time_index(None) are valid calls and no longer result in an error.

@gsheni, @tamargrey Do you think we need to implement reset_index and reset_time_index methods, or can we close this issue?

@tamargrey
Copy link
Contributor

If I were a user I'd probably go looking for a reset_index function before supplying the set_index function with None, but this probably isn't super pressing.

Another difference is also that the change only happens inplace now, and if we view this issue as there being a problem with
uneven behavior between the two index setters, then that problem no long exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants