Skip to content

Conversation

@ahmednabiled
Copy link

closes #58063 (partially)

  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

This PR validates and fixes the docstring for pandas.Period.freq to conform with the NumPy docstring standard.

The following changes were made:
• Converted the freq attribute from a cdef readonly Cython attribute to a Python property to enable proper docstring documentation, resolving a GL08 validation error.
• Added a fully-featured docstring (including Returns, See Also, and Examples sections) to the .freq property following NumPy docstring standards.
• Removed the now-passing method from the ignore list in ci/code_checks.sh.

- Convert freq from cdef readonly to @Property with proper docstring
- Add comprehensive NumPy-style docstring following pandas standards
- Include Returns, See Also, and Examples sections
- Remove pandas.Period.freq GL08 from ci/code_checks.sh ignore list

Part of pandas-dev#58063
- Remove trailing whitespace from blank lines
- Fix formatting to pass CI pre-commit hooks
self._dtype = PeriodDtypeBase(freq._period_dtype_code, freq.n)

@property
def freq(self) -> BaseOffset:
Copy link
Member

Choose a reason for hiding this comment

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

this change is going to (slightly) slow down a lot of methods. im not sure its worth it

Copy link
Author

@ahmednabiled ahmednabiled Oct 21, 2025

Choose a reason for hiding this comment

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

this is my first contribution I was just trying to get started and understand how to deal with contributing, any ways thank you for the comment I will start something else that may be a better fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC: Enforce Numpy Docstring Validation (Parent Issue)

2 participants