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

BUG: pd.offsets.MonthEnd() delevers wrong month #49133

Closed
wants to merge 6 commits into from
Closed

BUG: pd.offsets.MonthEnd() delevers wrong month #49133

wants to merge 6 commits into from

Conversation

jtimko16
Copy link

@jtimko16 jtimko16 commented Oct 16, 2022

[DOC] - Added more examples and explanation regarding MonthEnd method.

[DOC] - Added more examples and explanation regarding MonthEnd method.
@jtimko16 jtimko16 marked this pull request as draft October 16, 2022 20:52
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

This is off to a good start - could you update the PR title to be the same as the issue?

Comment on lines 2480 to 2484
When parameter n=0, always offset to the end of month.

When parameter n=1, depend on the given date:
a) Given date is on an anchor point (last day of the month) -> offset to the end of the following month.
b) Given date is not on an anchor point -> offset to the end of the same month.
Copy link
Member

Choose a reason for hiding this comment

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

can these go in the description of the n parameter?

Timestamp('2022-01-31 00:00:00')

Copy link
Member

Choose a reason for hiding this comment

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

can you add a short sentence before the examples you've added to clarify what the reader is meant to take away from them? see https://pandas.pydata.org/docs/development/contributing_docstring.html#section-7-examples

@MarcoGorelli
Copy link
Member

you'll also need

closes #48779

in the PR description (as per the template)

@jtimko16 jtimko16 changed the title Update offsets.pyx BUG: pd.offsets.MonthEnd() delevers wrong month Oct 17, 2022
@jtimko16 jtimko16 changed the title BUG: pd.offsets.MonthEnd() delevers wrong month BUG: pd.offsets.MonthEnd() delevers wrong month (closes #48779) Oct 17, 2022
@MarcoGorelli
Copy link
Member

and finally, you should check that pre-commit run --files pandas/_libs/tslibs/offsets.pyx passes

@jtimko16
Copy link
Author

@MarcoGorelli Thanks for your comments. Very useful. I've made some updates now and another updates will follow this evening!

@jtimko16
Copy link
Author

@MarcoGorelli I still receive error regarding trailing white spaces:

image

However I removed all the white spaces in the end of lines. Not sure what else I could do. Do you have any idea, what may cause this problem?

@MarcoGorelli
Copy link
Member

the hook has taken care of it for you - now you can just do git add -u and git commit again

as an aside, please don't post images of code

Comment on lines +2482 to +2487
n : int, default 1
n = 0 -> offset to the end of month.
n = 1 -> depend on the given date:
a) Given date is on an anchor point (last day of the month) -> offset to the end of the following month.
b) Given date is not on an anchor point -> offset to the end of the same month.

Copy link
Member

Choose a reason for hiding this comment

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

does this look right? can you try building this page of the docs to check please? https://pandas.pydata.org/docs/dev/development/contributing_documentation.html

Copy link
Author

Choose a reason for hiding this comment

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

Ok, but I will need more time for this. I still have trouble with setting up virtual environment (spend one hour with it today and will continue tomorrow)

Copy link
Author

@jtimko16 jtimko16 Oct 18, 2022

Choose a reason for hiding this comment

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

What is the version of Python you are using? I created a virtual environment on top of Python 3.10, and trying to install packagse from requirements-dev.txt, however it always stuck at installation of boto3:
`

Using cached boto3-1.24.38-py3-none-any.whl (132 kB)
Using cached boto3-1.24.37-py3-none-any.whl (132 kB)
Using cached boto3-1.24.36-py3-none-any.whl (132 kB)
Using cached boto3-1.24.35-py3-none-any.whl (132 kB)
Using cached boto3-1.24.34-py3-none-any.whl (132 kB)
Using cached boto3-1.24.33-py3-none-any.whl (132 kB)
Using cached boto3-1.24.32-py3-none-any.whl (132 kB)`

Is it better to use older version of Python - e.g. 3.9? Thanks

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

please do ask (here or on Slack) if it's unclear / anything trips you up

Copy link
Author

Choose a reason for hiding this comment

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

I tried to run it again, and also installed C++ Build Tools, but still receiving similar error. Please see below the full traceback:
Traceback_error.txt

Copy link
Member

Choose a reason for hiding this comment

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

I don't know, sorry - you could ask on Slack , or try using Ubuntu via the WSL on Windows

Copy link
Author

Choose a reason for hiding this comment

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

Hi, thank you. I don't want to sound like giving up. However unfortunately, this is going deeper and deeper technical, and I feel I am not able to effectively contribute. Is it OK, if I share the updated text of documentation in thread under the issue, and leave it for someone more technically capable to proceed with implementation?

Copy link
Member

Choose a reason for hiding this comment

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

sure, that's fine, someone else can take this forwards, and if you feel like trying again, feel free to reach out and ask

Copy link
Author

Choose a reason for hiding this comment

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

Ok, thanks. Maybe I will give it another go this weekend. Will let you know how I decide to proceed then. Thanks

pandas/_libs/tslibs/offsets.pyx Outdated Show resolved Hide resolved
pandas/_libs/tslibs/offsets.pyx Outdated Show resolved Hide resolved
jtimko16 and others added 2 commits October 17, 2022 16:56
Co-authored-by: Marco Edward Gorelli <33491632+MarcoGorelli@users.noreply.github.com>
Co-authored-by: Marco Edward Gorelli <33491632+MarcoGorelli@users.noreply.github.com>
@jtimko16 jtimko16 changed the title BUG: pd.offsets.MonthEnd() delevers wrong month (closes #48779) BUG: pd.offsets.MonthEnd() delevers wrong month Oct 17, 2022
@jtimko16
Copy link
Author

the hook has taken care of it for you - now you can just do git add -u and git commit again

as an aside, please don't post images of code

Ok, sure. Let me do it tomorrow. Today I am editing directly on the website, as I don't have access to my personal laptop to run git commands. I'll let you know tomorrow evening, in case the issue remains. Thanks.

And ok.

@mroeschke mroeschke added Frequency DateOffsets Docs labels Oct 17, 2022
@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Nov 21, 2022
@MarcoGorelli
Copy link
Member

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

closing for now, but feel free to ping if you want to keep working on this and I can reopen

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

Successfully merging this pull request may close these issues.

BUG: pd.offsets.MonthEnd() delevers wrong month
3 participants