pandas icon indicating copy to clipboard operation
pandas copied to clipboard

DOC: fix docstring validation errors for `pandas.Timestamp`

Open natmokval opened this issue 1 year ago • 19 comments

follow up on issues #56804 and #58063 pandas has a script for validating docstrings:

https://github.com/pandas-dev/pandas/blob/0cdc6a48302ba1592b8825868de403ff9b0ea2a5/ci/code_checks.sh#L206-L244

Currently, some methods fail docstring validation check. The task here is:

  • take 2-4 methods
  • run: scripts/validate_docstrings.py <method-name>
  • fix the docstrings according to whatever error is reported
  • remove those methods from code_checks.sh script
  • commit, push, open pull request

Example:

scripts/validate_docstrings.py pandas.Timestamp.tz_localize

pandas.Timestamp.tz_localize fails with the SA01 error

################################################################################
################################## Validation ##################################
################################################################################

1 Errors found for `pandas.Timestamp.tz_localize`:
        SA01    See Also section not found

Please don't comment take as multiple people can work on this issue. You also don't need to ask for permission to work on this, just comment on which methods are you going to work.

If you're new contributor, please check the contributing guide

natmokval avatar Aug 09 '24 11:08 natmokval

I will take pandas.Timestamp.combine pandas.Timestamp.ctime pandas.Timestamp.date

mimistiv avatar Aug 09 '24 12:08 mimistiv

Taking replace, normalize, to_numpy, and to_period

EduardAkhmetshin avatar Aug 09 '24 12:08 EduardAkhmetshin

Listing as a checklist to tracked the tasks that are already picked

  • [x] -i "pandas.Timestamp.combine PR01,SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277848804
  • [x] -i "pandas.Timestamp.ctime SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277848804
  • [x] -i "pandas.Timestamp.date SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277848804
  • [x] -i "pandas.Timestamp.day GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277915097
  • [x] -i "pandas.Timestamp.fold GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277915097
  • [x] -i "pandas.Timestamp.fromordinal SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2281748570
  • [x] -i "pandas.Timestamp.fromtimestamp PR01,SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2281748570
  • [x] -i "pandas.Timestamp.hour GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277964718
  • [x] -i "pandas.Timestamp.max PR02" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277964718
  • [x] -i "pandas.Timestamp.microsecond GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277964718
  • [x] -i "pandas.Timestamp.min PR02" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277964718
  • [x] -i "pandas.Timestamp.minute GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2282326767
  • [x] -i "pandas.Timestamp.month GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2282326767
  • [x] -i "pandas.Timestamp.month_name SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278954301
  • [x] -i "pandas.Timestamp.nanosecond GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2282326767
  • [x] -i "pandas.Timestamp.normalize SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277858099
  • [x] -i "pandas.Timestamp.quarter SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278954301
  • [x] -i "pandas.Timestamp.replace PR07,SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277858099
  • [x] -i "pandas.Timestamp.resolution PR02" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2283015310
  • [x] -i "pandas.Timestamp.second GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2282326767
  • [x] -i "pandas.Timestamp.strptime PR01,SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278582882
  • [x] -i "pandas.Timestamp.timestamp SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278582882
  • [x] -i "pandas.Timestamp.timetuple SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278582882
  • [x] -i "pandas.Timestamp.timetz SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278582882
  • [x] -i "pandas.Timestamp.to_datetime64 SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278582882
  • [x] -i "pandas.Timestamp.to_julian_date SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278582882
  • [x] -i "pandas.Timestamp.to_numpy PR01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277858099
  • [x] -i "pandas.Timestamp.to_period PR01,SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2277858099
  • [x] -i "pandas.Timestamp.today SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278150810
  • [x] -i "pandas.Timestamp.toordinal SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278150810
  • [x] -i "pandas.Timestamp.tz_localize SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2282834048
  • [x] -i "pandas.Timestamp.tzinfo GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2283015310
  • [x] -i "pandas.Timestamp.tzname SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2282834048
  • [x] -i "pandas.Timestamp.unit SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2282679680
  • [x] -i "pandas.Timestamp.utcfromtimestamp PR01,SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2282834048
  • [x] -i "pandas.Timestamp.utcoffset SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2282679680
  • [x] -i "pandas.Timestamp.utctimetuple SA01" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2282679680
  • [x] -i "pandas.Timestamp.value GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278898146
  • [x] -i "pandas.Timestamp.year GL08" \ https://github.com/pandas-dev/pandas/issues/59458#issuecomment-2278898146

NavaneetthaSundararaj avatar Aug 09 '24 13:08 NavaneetthaSundararaj

I will take:

pandas.Timestamp.hour pandas.Timestamp.max pandas.Timestamp.microsecond pandas.Timestamp.min

NavaneetthaSundararaj avatar Aug 09 '24 13:08 NavaneetthaSundararaj

I'll take "pandas.Timestamp.today" "pandas.Timestamp.toordinal "

dnajjar avatar Aug 09 '24 14:08 dnajjar

I'll take

-i "pandas.Timestamp.strptime PR01,SA01" \
-i "pandas.Timestamp.timestamp SA01" \
-i "pandas.Timestamp.timetuple SA01" \
-i "pandas.Timestamp.timetz SA01" \
-i "pandas.Timestamp.to_datetime64 SA01" \
-i "pandas.Timestamp.to_julian_date SA01" \

jsngn avatar Aug 09 '24 19:08 jsngn

I'll take -i "pandas.Timestamp.year GL08"
-i "pandas.Timestamp.value GL08" \

zocacc avatar Aug 10 '24 00:08 zocacc

i'll take

-i pandas.Timestamp.month_name SA01 -i "pandas.Timestamp.quarter SA01

josh-tan77 avatar Aug 10 '24 03:08 josh-tan77

I'll take

-i "pandas.Timestamp.fromordinal SA01" -i "pandas.Timestamp.fromtimestamp PR01,SA01"

znarfm avatar Aug 10 '24 13:08 znarfm

I'll take: -i "pandas.Timestamp.minute GL08"
-i "pandas.Timestamp.month GL08"
-i "pandas.Timestamp.nanosecond GL08"
-i "pandas.Timestamp.second GL08" \

CICDooley avatar Aug 11 '24 00:08 CICDooley

I'll take:

-i "pandas.Timestamp.unit SA01" \
 -i "pandas.Timestamp.utcoffset SA01" \
 -i "pandas.Timestamp.utctimetuple SA01"

shreyas-dev avatar Aug 11 '24 08:08 shreyas-dev

I'll take: pandas.Timestamp.tz_localize pandas.Timestamp.tzname pandas.Timestamp.utcfromtimestamp

MichaelMoyles avatar Aug 11 '24 17:08 MichaelMoyles

i will take:

-i "pandas.Timestamp.utcoffset SA01"
-i "pandas.Timestamp.utctimetuple SA01" \

Blacksujit avatar Aug 13 '24 17:08 Blacksujit

I'll take : pandas.Timestamp.tz_localize SA01 pandas.Timestamp.tzinfo GL08 pandas.Timestamp.tzname SA01

SHYALI avatar Aug 21 '24 09:08 SHYALI

ill take: -i "pandas.Timestamp.utcfromtimestamp PR01,SA01"
-i "pandas.Timestamp.utcoffset SA01"
-i "pandas.Timestamp.utctimetuple SA01" \

40gilad avatar Aug 22 '24 09:08 40gilad

did anyone understand how it should be done? im chaning the doc of my functions in timestamp.pyx, nattype.pyx and nothing is being changed when im running scripts/validate_docstrings.py

40gilad avatar Aug 22 '24 13:08 40gilad

did anyone understand how it should be done? im chaning the doc of my functions in timestamp.pyx, nattype.pyx and nothing is being changed when im running scripts/validate_docstrings.py

@40gilad, did you rebuild pandas after your changes? You need to compile pandas again each time the C extensions change, for example if you modified any file in pandas/_libs. Please check the documetation "Contributing to pandas", particularly the section: build and install pandas

natmokval avatar Aug 22 '24 14:08 natmokval

did anyone understand how it should be done? im chaning the doc of my functions in timestamp.pyx, nattype.pyx and nothing is being changed when im running scripts/validate_docstrings.py

@40gilad, did you rebuild pandas after your changes? You need to compile pandas again each time the C extensions change, for example if you modified any file in pandas/_libs. Please check the documetation "Contributing to pandas", particularly the section: build and install pandas

i get: error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\link.exe' failed with exit code 1120

40gilad avatar Aug 22 '24 16:08 40gilad

It seems like the only method not picked is pandas.Timestamp.resolution. I will work on this method.

natmokval avatar Aug 30 '24 16:08 natmokval

I will take:

pandas.Timestamp.hour pandas.Timestamp.max pandas.Timestamp.microsecond pandas.Timestamp.min

Hour and microsecond seems to be done by https://github.com/pandas-dev/pandas/pull/59622

NavaneetthaSundararaj avatar Aug 30 '24 19:08 NavaneetthaSundararaj

i see those question are still on code_checks.sh could i take

-i "pandas.Timestamp.nanosecond GL08" -i "pandas.Timestamp.year GL08" \

asdkfjsd avatar Oct 10 '24 10:10 asdkfjsd

i see those question are still on code_checks.sh could i take

-i "pandas.Timestamp.nanosecond GL08" -i "pandas.Timestamp.year GL08" \

Hello @asdkfjsd I have a PR open for this and have been waiting for a review for a while now. @MarcoGorelli

mimistiv avatar Oct 10 '24 10:10 mimistiv

i see those question are still on code_checks.sh could i take

-i "pandas.Timestamp.nanosecond GL08" -i "pandas.Timestamp.year GL08" \

Hello @asdkfjsd I have a PR open for this and have been waiting for a review for a while now. @MarcoGorelli

i'm sorry , i will find another one

asdkfjsd avatar Oct 10 '24 11:10 asdkfjsd

I think all the tasks are picked already 😅.

amitsubhashchejara avatar Oct 20 '24 09:10 amitsubhashchejara

I'll take: pandas.Timestamp.tz_localize pandas.Timestamp.toordinal

vineethsaivs avatar Dec 21 '24 22:12 vineethsaivs

Do any functions still need to be fixed?

chinar-amrutkar avatar Feb 25 '25 16:02 chinar-amrutkar

I'll take pandas.Timestamp.resolution

olivecon avatar Mar 11 '25 22:03 olivecon

Timestamp.tzinfo has already been resolved here: #61100

j-hendricks avatar Mar 17 '25 17:03 j-hendricks

Taking the following:

    -i "pandas.Timestamp.max PR02" \
    -i "pandas.Timestamp.min PR02" \
    -i "pandas.Timestamp.resolution PR02" \

j-hendricks avatar Apr 06 '25 10:04 j-hendricks