Skip to content

BUG: Add frequency to DatetimeArray/TimedeltaArray take #58382

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

Merged

Conversation

annika-rudolph
Copy link
Contributor

@annika-rudolph annika-rudolph commented Apr 23, 2024

Disclaimer I am required to add that the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

@annika-rudolph annika-rudolph changed the title Add take function to Datetime and TimedeltaArray (GH 57949 and GH 58327) Add take function to Datetime and TimedeltaArray Apr 23, 2024
@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch 2 times, most recently from 19d396d to 5440815 Compare April 25, 2024 08:22
@annika-rudolph annika-rudolph changed the title Add take function to Datetime and TimedeltaArray BUG: Add frequency to DatetimeIndex/TimedeltaIndex shallow copy Apr 25, 2024
@annika-rudolph annika-rudolph changed the title BUG: Add frequency to DatetimeIndex/TimedeltaIndex shallow copy BUG: Add frequency to DatetimeIndex/TimedeltaIndex _shallow_copy Apr 25, 2024
@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch from 30a69e1 to 30be34a Compare April 25, 2024 11:27
@annika-rudolph annika-rudolph marked this pull request as ready for review April 25, 2024 12:22
@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch from 195a9a5 to e67ca27 Compare April 29, 2024 09:32
@@ -1244,7 +1244,9 @@ def _constructor(self) -> Callable[..., MultiIndex]: # type: ignore[override]
return type(self).from_tuples

@doc(Index._shallow_copy)
def _shallow_copy(self, values: np.ndarray, name=lib.no_default) -> MultiIndex:
def _shallow_copy(
Copy link
Member

Choose a reason for hiding this comment

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

if the options are doing this in take or shallow_copy, take is definitely preferred

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done -- implemented via take

@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch from d49d42c to b2a244a Compare April 30, 2024 15:19
@annika-rudolph annika-rudolph changed the title BUG: Add frequency to DatetimeIndex/TimedeltaIndex _shallow_copy BUG: Add frequency to DatetimeArray/TimedeltaArray take Apr 30, 2024
@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch 2 times, most recently from cae8e63 to ceb3633 Compare May 3, 2024 07:49
@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch 2 times, most recently from 4bedc39 to 9b480bf Compare May 7, 2024 13:52

if isinstance(maybe_slice, slice):
freq = self._get_getitem_freq(maybe_slice)
result.freq = freq
Copy link
Member

Choose a reason for hiding this comment

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

i think if you set result._freq it will be more performant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jbrockmendel is this now corresponding to your idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jbrockmendel , any news on this? would be nice to finish the PR at some point :)

@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch from 9b480bf to b5e228b Compare May 10, 2024 06:40
@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch 6 times, most recently from 342ee5e to 6a2649b Compare May 15, 2024 06:47
@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch 4 times, most recently from a8788a0 to ab23100 Compare May 21, 2024 19:54
@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch 3 times, most recently from dad1473 to d6f0e86 Compare June 13, 2024 11:11
@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch 3 times, most recently from fae221c to 05e2bb6 Compare July 9, 2024 13:13
@annika-rudolph annika-rudolph force-pushed the fix_get_level_values_gh_58327 branch from 05e2bb6 to 0dd9feb Compare July 10, 2024 12:53
@mroeschke mroeschke added this to the 3.0 milestone Jul 11, 2024
@mroeschke mroeschke merged commit ac13a09 into pandas-dev:main Jul 11, 2024
45 checks passed
@mroeschke
Copy link
Member

Thanks @annika-rudolph (sorry for the delay here)

@annika-rudolph annika-rudolph deleted the fix_get_level_values_gh_58327 branch July 12, 2024 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants