Skip to content

ENH: to_datetime support iso week year (16607) Updated #24844

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

Closed
wants to merge 220 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
220 commits
Select commit Hold shift + click to select a range
18edbd6
Added support for iso time
RjLi13 Jan 20, 2019
f3183f0
Added whatsnew entry?
RjLi13 Jan 20, 2019
89921a3
n
RjLi13 Jan 20, 2019
b4f149c
Merge remote-tracking branch 'upstream/master' into pandas-rosy-new
RjLi13 Jan 20, 2019
9ee53bd
Fix linting error
RjLi13 Jan 20, 2019
7c3a305
Add changes from reviewer
RjLi13 Jan 20, 2019
e99049a
Fix errors found in azure
RjLi13 Jan 21, 2019
ca9a9b4
Merge remote-tracking branch 'upstream/master' into pandas-rosy-new
RjLi13 Jan 22, 2019
a5eff18
Merge remote-tracking branch 'upstream/master' into pandas-rosy-new
RjLi13 Jan 27, 2019
fcc11fe
Making change to one thing
RjLi13 Jan 28, 2019
9f2c421
STY: use pytest.raises context syntax (indexing) (#24960)
simonjayhawkins Jan 28, 2019
bf693ff
Fixed itertuples usage in to_dict (#24965)
TomAugspurger Jan 28, 2019
3fd47fe
STY: use pytest.raises context manager (resample) (#24977)
simonjayhawkins Jan 28, 2019
ba7b895
DOC: Document breaking change to read_csv (#24989)
TomAugspurger Jan 29, 2019
dd16aa7
DEPR: Fixed warning for implicit registration (#24964)
TomAugspurger Jan 29, 2019
145ade2
STY: use pytest.raises context manager (indexes/datetimes) (#24995)
simonjayhawkins Jan 29, 2019
6449bc1
DOC: move whatsnew note of #24916 (#24999)
jorisvandenbossche Jan 29, 2019
1fc88c7
BUG: Fix broken links (#25002)
yoanngoular Jan 29, 2019
abf0824
fix for BUG: grouping with tz-aware: Values falls after last bin (#24…
ahcub Jan 29, 2019
ece58cb
REGR: Preserve order by default in Index.difference (#24967)
TomAugspurger Jan 29, 2019
3f90255
CLN: do not use .repeat asv setting for storing benchmark data (#25015)
qwhelan Jan 30, 2019
5d1e633
CLN: isort asv_bench/benchmark/algorithms.py (#24958)
gasparia405 Jan 30, 2019
7486808
fix+test to_timedelta('NaT', box=False) (#24961)
jbrockmendel Jan 30, 2019
b9f2e2b
PERF: significant speedup in sparse init and ops by using numpy in ch…
qwhelan Jan 30, 2019
6220d22
BUG: Fixed merging on tz-aware (#25033)
TomAugspurger Jan 30, 2019
32c0a5d
Test nested PandasArray (#24993)
TomAugspurger Jan 30, 2019
515b0fa
DOC: fix error in documentation #24981 (#25038)
johnnychiuchiu Jan 30, 2019
4cbee17
BUG: support dtypes in column_dtypes for to_records() (#24895)
qwhelan Jan 30, 2019
3052eb1
Makes example from docstring work (#25035)
heavelock Jan 31, 2019
c4cc9fc
CLN: typo fixups (#25028)
jbrockmendel Jan 31, 2019
534bce9
BUG: to_datetime(strs, utc=True) used previous UTC offset (#25020)
mroeschke Jan 31, 2019
149138e
BUG: Better handle larger numbers in to_numeric (#24956)
gfyoung Jan 31, 2019
da5f5eb
BUG: avoid usage in_qtconsole for recent IPython versions (#25039)
TomAugspurger Jan 31, 2019
ea013a2
REGR: fix read_sql delegation for queries on MySQL/pymysql (#25024)
jorisvandenbossche Jan 31, 2019
5c40cf2
DOC: Start 0.24.2.rst (#25026)
TomAugspurger Feb 1, 2019
a0623af
REGR: rename_axis with None should remove axis name (#25069)
jschendel Feb 1, 2019
76f5d2d
clarified the documentation for DF.drop_duplicates (#25056)
mjmdavis Feb 1, 2019
01483d7
Clarification in docstring of Series.value_counts (#25062)
AllenDowney Feb 1, 2019
6d7bd98
ENH: Support fold argument in Timestamp.replace (#25046)
mroeschke Feb 1, 2019
5e224fb
CLN: to_pickle internals (#25044)
mroeschke Feb 1, 2019
d4b42c8
Implement+Test Tick.__rtruediv__ (#24832)
jbrockmendel Feb 1, 2019
25ff472
API: change Index set ops sort=True -> sort=None (#25063)
jorisvandenbossche Feb 1, 2019
89dd4d6
BUG: to_clipboard text truncated for Python 3 on Windows for UTF-16 t…
david-liu-brattle-1 Feb 1, 2019
3a0fbfd
PERF: use new to_records() argument in to_stata() (#25045)
qwhelan Feb 1, 2019
bb43726
DOC: Cleanup 0.24.1 whatsnew (#25084)
TomAugspurger Feb 1, 2019
41778b0
Fix quotes position in pandas.core, typos and misspelled parameters. …
alanderex Feb 2, 2019
fb02c25
CLN: Remove sentinel_factory() in favor of object() (#25074)
jschendel Feb 2, 2019
f75a220
TST: remove DST transition scenarios from tc #24689 (#24736)
robbuckley Feb 2, 2019
800d38b
BLD: remove spellcheck from Makefile (#25111)
kynan Feb 3, 2019
375c790
DOC: small clean-up of 0.24.1 whatsnew (#25096)
jorisvandenbossche Feb 3, 2019
a814ea4
DOC: small doc fix to Series.repeat (#25115)
nooraLeila Feb 3, 2019
a488ab8
TST: tests for categorical apply (#25095)
alimcmaster1 Feb 3, 2019
0d3b4f4
CLN: use dtype in constructor (#25098)
topper-123 Feb 3, 2019
14a2da1
DOC: frame.py doctest fixing (#25097)
stijnvanhoey Feb 3, 2019
51e6cb1
DOC: 0.24.1 release (#25125)
TomAugspurger Feb 3, 2019
1fc38f6
Revert set_index inspection/error handling for 0.24.1 (#25085)
h-vetinari Feb 3, 2019
d3c9d6e
DOC/CLN: Timezone section in timeseries.rst (#24825)
mroeschke Feb 3, 2019
88318e3
DOC: Fix validation type error RT04 (#25107) (#25129)
MarckK Feb 4, 2019
3eccea3
Reading a HDF5 created in py2 (#25058)
rbenes Feb 4, 2019
ecc437a
BUG: Fixing regression in DataFrame.all and DataFrame.any with bool_o…
devin-petersohn Feb 4, 2019
f3f1edd
Removal of return variable names (#25123)
Fosnet Feb 4, 2019
2199f34
DOC: Improve docstring of Series.mul (#25136)
lordgrenville Feb 4, 2019
2e38d55
TST/REF: collect DataFrame reduction tests (#24914)
jbrockmendel Feb 4, 2019
e3b0950
Fix validation error type `SS05` and check in CI (#25133)
thoo Feb 4, 2019
f04bb2f
Fixed tuple to List Conversion in Dataframe class (#25089)
Vibhu-Agarwal Feb 6, 2019
5db3455
STY: use pytest.raises context manager (indexes/multi) (#25175)
simonjayhawkins Feb 6, 2019
bd58782
DOC: Updates to Timestamp document (#25163)
saurav-chakravorty Feb 6, 2019
2d8f0ab
BLD: pin cython language level to '2' (#25145)
tacaswell Feb 6, 2019
9cac5a9
CLN: Use ABCs in set_index (#25128)
h-vetinari Feb 6, 2019
efa23ca
DOC: update docstring for series.nunique (#25116)
cecilialiao Feb 6, 2019
776530c
DEPR: remove PanelGroupBy, disable DataFrame.to_panel (#25047)
jbrockmendel Feb 6, 2019
09633b8
BUG: DataFrame.merge(suffixes=) does not respect None (#24819)
charlesdong1991 Feb 6, 2019
93568cc
fix MacPython pandas-wheels failure (#25186)
simonjayhawkins Feb 6, 2019
638ddeb
modernize compat imports (#25192)
jbrockmendel Feb 6, 2019
51fca4c
TST: follow-up to Test nested pandas array #24993 (#25155)
simonjayhawkins Feb 7, 2019
5278cc6
DOC/CLN: Fix errors in Series docstrings (#24945)
Feb 7, 2019
0535180
REF: Add more pytest idiom to test_holiday.py (#25204)
gfyoung Feb 7, 2019
683c7b5
DOC: Fix validation type error SA05 (#25208)
MarckK Feb 7, 2019
2816dba
BUG: Fix Series.is_unique with single occurrence of NaN (#25182)
jschendel Feb 8, 2019
833bf70
REF: Remove many Panel tests (#25191)
jbrockmendel Feb 8, 2019
1c57308
DOC: Fixes to docstrings and add PR10 (space before colon) to validat…
victormoron Feb 8, 2019
cf3ad87
DOC: exclude autogenerated c/cpp/html files from 'trailing whitespace…
saurav-chakravorty Feb 8, 2019
0eddba8
STY: use pytest.raises context manager (indexes/period) (#25199)
simonjayhawkins Feb 8, 2019
1d1b14c
fix ci failures (#25225)
simonjayhawkins Feb 8, 2019
b08a584
DEPR: remove tm.makePanel and all usages (#25231)
jbrockmendel Feb 8, 2019
eb2ab3a
DEPR: Remove Panel-specific parts of io.pytables (#25233)
jbrockmendel Feb 8, 2019
04df22f
DEPR: Add Deprecated warning for timedelta with passed units M and Y …
ryankarlos Feb 8, 2019
977bcf8
BUG-25061 fix printing indices with NaNs (#25202)
JustinZhengBC Feb 9, 2019
d7a0964
BUG: Fix regression in DataFrame.apply causing RecursionError (#25230)
gioiab Feb 9, 2019
7ee5b92
BUG: Fix read_json orient='table' without index (#25170) (#25171)
albertvillanova Feb 9, 2019
f67b7fd
BLD: prevent asv from calling sys.stdin.close() by using different la…
qwhelan Feb 9, 2019
a4f5987
(Closes #25029) Removed extra bracket from cheatsheet code example. (…
M-YD Feb 9, 2019
0508d81
CLN: For loops, boolean conditions, misc. (#25206)
mroeschke Feb 9, 2019
2448e52
Refactor groupby group_add from tempita to fused types (#24954)
noamher Feb 9, 2019
5f73594
CLN: Remove ipython 2.x compat (#25150)
TomAugspurger Feb 9, 2019
ca5b1df
BUG: Duplicated returns boolean dataframe (#25234)
Feb 11, 2019
2c25197
REF/TST: resample/test_base.py (#25262)
simonjayhawkins Feb 11, 2019
75d5b48
Revert "BLD: prevent asv from calling sys.stdin.close() by using diff…
TomAugspurger Feb 11, 2019
91992ad
BUG: pandas Timestamp tz_localize and tz_convert do not preserve `fre…
charlesdong1991 Feb 11, 2019
28025fd
DEPR: remove assert_panel_equal (#25238)
jbrockmendel Feb 11, 2019
147b923
PR04 errors fix (#25157)
mwoss Feb 11, 2019
6359bbc
Split Excel IO Into Sub-Directory (#25153)
WillAyd Feb 11, 2019
57fb83f
API: Ensure DatetimeTZDtype standardizes pytz timezones (#25254)
mroeschke Feb 11, 2019
ea1d5f5
BUG: Fix exceptions when Series.interpolate's `order` parameter is mi…
nmusolino Feb 11, 2019
a9a03a2
BUG: DataFrame.join on tz-aware DatetimeIndex (#25260)
mroeschke Feb 11, 2019
ec5f911
REF: use _constructor and ABCFoo to avoid runtime imports (#25272)
jbrockmendel Feb 11, 2019
64d8948
Refactor groupby group_prod, group_var, group_mean, group_ohlc (#25249)
noamher Feb 11, 2019
3ab9318
Fix typo in Cheat sheet with regex (#25215)
Dr-Irv Feb 11, 2019
4d44a2a
Edit parameter type in pandas.core.frame.py DataFrame.count (#25198)
kpapdac Feb 12, 2019
a89e19d
TST/CLN: remove test_slice_ints_with_floats_raises (#25277)
simonjayhawkins Feb 13, 2019
b8306f1
Removed Panel class from HDF ASVs (#25281)
WillAyd Feb 13, 2019
6a8e708
DOC: Fix minor typo in docstring (#25285)
elcombato Feb 14, 2019
b144f66
DOC/CLN: Fix errors in DataFrame docstrings (#24952)
Feb 14, 2019
790e575
Skipped broken Py2 / Windows test (#25323)
WillAyd Feb 14, 2019
4be995c
Rt05 documentation error fix issue 25108 (#25309)
zangell44 Feb 14, 2019
53281a5
Fix typos in docs (#25305)
tnir Feb 15, 2019
83fe6ca
Doc: corrects spelling in generic.py (#25333)
jevandezande Feb 15, 2019
9de4cc1
BUG: groupby.transform retains timezone information (#25264)
mroeschke Feb 16, 2019
33b11b9
Fixes Formatting Exception (#25088)
EternalLearner42 Feb 16, 2019
ea9848c
Bug: OverflowError in resample.agg with tz data (#25297)
mroeschke Feb 16, 2019
eace576
DOC/CLN: Fix various docstring errors (#25295)
Feb 16, 2019
2ce2196
COMPAT: alias .to_numpy() for timestamp and timedelta scalars (#25142)
Feb 16, 2019
b0dac6c
ENH: Support times with timezones in at_time (#25280)
mroeschke Feb 16, 2019
29008f5
BUG: Fix passing of numeric_only argument for categorical reduce (#25…
arnov Feb 16, 2019
4a20d5b
TST: use a fixed seed to have the same uniques across python versions…
jreback Feb 16, 2019
659e0ca
TST: xfail excel styler tests, xref GH25351 (#25352)
jreback Feb 17, 2019
b90bcb5
DOC: Correct doc mistake in combiner func (#25360)
gfyoung Feb 18, 2019
f74aba6
DOC/BLD: fix --no-api option (#25209)
jorisvandenbossche Feb 18, 2019
3d3093a
DOC: modify typos in Contributing section (#25365)
alyssafuward Feb 19, 2019
590cb54
Remove spurious MultiIndex creation in `_set_axis_name` (#25371)
devin-petersohn Feb 19, 2019
9561b96
#23049: test for Fatal Stack Overflow stemming From Misuse of astype(…
Feb 19, 2019
dbe3579
9236: test for the DataFrame.groupby with MultiIndex having pd.NaT (#…
Feb 19, 2019
c400bd3
[BUG] exception handling of MultiIndex.__contains__ too narrow (#25268)
makbigc Feb 19, 2019
f9cb581
14873: test for groupby.agg coercing booleans (#25327)
Feb 19, 2019
b2c7519
BUG/ENH: Timestamp.strptime (#25124)
saurav-chakravorty Feb 19, 2019
2909b83
Interval dtype fix (#25338)
zangell44 Feb 20, 2019
f4568fd
[CLN] Excel Module Cleanups (#25275)
tdamsma Feb 20, 2019
66d486e
ENH: indexing and __getitem__ of dataframe and series accept zerodim …
tamuhey Feb 20, 2019
def8b96
REGR: fix TimedeltaIndex sum and datetime subtraction with NaT (#2528…
jbrockmendel Feb 20, 2019
13a505d
edited whatsnew typo (#25381)
saurav-chakravorty Feb 20, 2019
6c4cb6f
fix typo of see also in DataFrame stat funcs (#25388)
knuu Feb 20, 2019
5449279
API: more consistent error message for MultiIndex.from_arrays (#25189)
simonjayhawkins Feb 20, 2019
9c0f6a8
CLN: (re-)enable infer_dtype to catch complex (#25382)
h-vetinari Feb 21, 2019
b673188
DOC: Edited docstring of Interval (#25410)
wdecoster Feb 22, 2019
fbe67d5
Mark test_pct_max_many_rows as high memory (#25400)
scarabeusiv Feb 22, 2019
f2fbebd
Correct a typo of version number for interpolate() (#25418)
willweil Feb 23, 2019
7408c9b
DEP: add pytest-mock to environment.yml (#25417)
h-vetinari Feb 23, 2019
15d8178
BUG: Fix type coercion in read_json orient='table' (#21345) (#25219)
albertvillanova Feb 23, 2019
5557e36
ERR: doc update for ParsingError (#25414)
sudhirmohanraj Feb 23, 2019
3855a27
ENH: Add in sort keyword to DatetimeIndex.union (#25110)
reidy-p Feb 23, 2019
183dc02
DOC: Rewriting of ParserError doc + minor spacing (#25421)
gfyoung Feb 24, 2019
5ae9b48
API/ERR: allow iterators in df.set_index & improve errors (#24984)
h-vetinari Feb 24, 2019
fc1fe83
BUG: Indexing with UTC offset string no longer ignored (#25263)
mroeschke Feb 24, 2019
df039bf
PERF/REF: improve performance of Series.searchsorted, PandasArray.sea…
topper-123 Feb 24, 2019
f59a6ab
TST: remove never-used singleton fixtures (#24885)
jbrockmendel Feb 24, 2019
85572de
BUG: fixed merging with empty frame containing an Int64 column (#2518…
josham Feb 24, 2019
aa08416
DOC: fixed geo accessor example in extending.rst (#25420)
ThibTrip Feb 25, 2019
fe1654f
TST: numpy RuntimeWarning with Series.round() (#25432)
simonjayhawkins Feb 27, 2019
1490d0c
CI: add __init__.py to isort skip list (#25455)
simonjayhawkins Feb 27, 2019
c986386
DOC: CategoricalIndex doc string (#24852)
topper-123 Feb 28, 2019
70802c2
DataFrame.drop Raises KeyError definition (#25474)
MaxVanDeursen Feb 28, 2019
3b570e3
BUG: Keep column level name in resample nunique (#25469)
gfyoung Feb 28, 2019
84875c1
ERR: Correct error message in to_datetime (#25467)
gfyoung Feb 28, 2019
ece6074
Fix minor typo (#25458)
pombredanne Feb 28, 2019
778affc
CI: Set pytest minversion to 4.0.2 (#25402)
simonjayhawkins Feb 28, 2019
72367b7
STY: use pytest.raises context manager (indexes) (#25447)
simonjayhawkins Feb 28, 2019
42a6246
STY: use pytest.raises context manager (tests/test_*) (#25452)
simonjayhawkins Feb 28, 2019
e52f063
Fix minor error in dynamic load function (#25256)
nmusolino Feb 28, 2019
64e5612
Cythonized GroupBy Quantile (#20405)
WillAyd Feb 28, 2019
50c40ff
BUG: Fix regression on DataFrame.replace for regex (#25266)
PetitLepton Feb 28, 2019
28abbee
Correct contribution guide docbuild instruction (#25479)
MaxVanDeursen Feb 28, 2019
f04342a
TST/REF: Add pytest idiom to test_frequencies.py (#25430)
gfyoung Feb 28, 2019
e9de5f3
BUG: Fix index type casting in read_json with orient='table' and floa…
albertvillanova Feb 28, 2019
169a56a
BUG: Groupby.agg with reduction function with tz aware data (#25308)
mroeschke Feb 28, 2019
ae1ab89
DOC: Fix docstring for read_sql_table (#25465)
igblackadder Feb 28, 2019
db978c7
ENH: Add Series.str.casefold (#25419)
charlesdong1991 Feb 28, 2019
0a61ecd
Fix PR10 error and Clean up docstrings from functions related to RT05…
thoo Mar 1, 2019
9bb98b8
Fix unreliable test (#25496)
mroeschke Mar 1, 2019
011f0a6
DOC: Clarifying doc/make.py --single parameter (#25482)
MaxVanDeursen Mar 1, 2019
1f8d7e0
fix MacPython / pandas-wheels ci failures (#25505)
simonjayhawkins Mar 1, 2019
1d3b4a5
DOC: Reword Series.interpolate docstring for clarity (#25491)
nmusolino Mar 1, 2019
ae4db86
Changed insertion order to sys.path (#25486)
WillAyd Mar 1, 2019
3e3c901
TST: xfail non-writeable pytables tests with numpy 1.16x (#25517)
jreback Mar 2, 2019
d708461
STY: use pytest.raises context manager (arithmetic, arrays, computati…
simonjayhawkins Mar 3, 2019
cc5b73e
BUG: Fix RecursionError during IntervalTree construction (#25498)
jschendel Mar 3, 2019
c66028c
STY: use pytest.raises context manager (plotting, reductions, scalar.…
simonjayhawkins Mar 3, 2019
ce47205
BUG: Fix potential segfault after pd.Categorical(pd.Series(...), cate…
batterseapower Mar 3, 2019
0c193c6
Make DataFrame.to_html output full content (#24841)
simonjayhawkins Mar 3, 2019
362f4e5
Added support for iso time
RjLi13 Jan 20, 2019
e6c4f9d
Added whatsnew entry?
RjLi13 Jan 20, 2019
b48d0fb
n
RjLi13 Jan 20, 2019
cf16177
Fix linting error
RjLi13 Jan 20, 2019
a323f74
Add changes from reviewer
RjLi13 Jan 20, 2019
cdd66c4
Fix errors found in azure
RjLi13 Jan 21, 2019
baad263
Making change to one thing
RjLi13 Jan 28, 2019
2fa0c65
Merge branch 'pandas-rosy-new' of https://github.com/RjLi13/pandas in…
RjLi13 Mar 3, 2019
42b4c97
BUG-16807-1 SparseFrame fills with default_fill_value if data is None…
JustinZhengBC Mar 3, 2019
149b7f8
Moved to 0.25.0
RjLi13 Mar 3, 2019
bd49d2f
DOC: Add conda uninstall pandas to contributing guide (#25490)
yehia67 Mar 3, 2019
705c442
fix segfault when running with cython coverage enabled, xref cython#2…
jbrockmendel Mar 4, 2019
f85f7a1
TST: inline empty_frame = DataFrame({}) fixture (#24886)
jbrockmendel Mar 4, 2019
1c9de69
DOC: Polishing typos out of doc/source/user_guide/indexing.rst (#25528)
leerssej Mar 4, 2019
3bbcacf
STY: use pytest.raises context manager (frame) (#25516)
simonjayhawkins Mar 4, 2019
076b5a8
DOC: Fix #24268 by updating description for keep in Series.nlargest (…
bharatr21 Mar 5, 2019
557bae0
Update docstrings
RjLi13 Mar 5, 2019
2de551f
Added support for iso time
RjLi13 Jan 20, 2019
cb1132c
Added whatsnew entry?
RjLi13 Jan 20, 2019
bd1c7dc
n
RjLi13 Jan 20, 2019
d8d06f9
Fix linting error
RjLi13 Jan 20, 2019
5accc8f
Add changes from reviewer
RjLi13 Jan 20, 2019
64dec4c
Fix errors found in azure
RjLi13 Jan 21, 2019
8f3c92e
Making change to one thing
RjLi13 Jan 28, 2019
ad03061
Added support for iso time
RjLi13 Jan 20, 2019
4d7af48
n
RjLi13 Jan 20, 2019
287f0ed
Fix linting error
RjLi13 Jan 20, 2019
1c3caf5
Fix errors found in azure
RjLi13 Jan 21, 2019
12951b9
Moved to 0.25.0
RjLi13 Mar 3, 2019
3c1959c
Update docstrings
RjLi13 Mar 5, 2019
f8bdc92
Rebased changes
RjLi13 Mar 5, 2019
f73952d
Fix merge conflict
RjLi13 Mar 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ See the :ref:`Advanced documentation on renaming<advanced.index_names>` for more
Other Enhancements
^^^^^^^^^^^^^^^^^^

- Added support for %G strptime directive in parsing datetimes
- :func:`merge` now directly allows merge between objects of type ``DataFrame`` and named ``Series``, without the need to convert the ``Series`` object into a ``DataFrame`` beforehand (:issue:`21220`)
- ``ExcelWriter`` now accepts ``mode`` as a keyword argument, enabling append to existing workbooks when using the ``openpyxl`` engine (:issue:`3441`)
- ``FrozenList`` has gained the ``.union()`` and ``.difference()`` methods. This functionality greatly simplifies groupby's that rely on explicitly excluding certain columns. See :ref:`Splitting an object into groups <groupby.split>` for more information (:issue:`15475`, :issue:`15506`).
Expand Down
71 changes: 64 additions & 7 deletions pandas/_libs/tslibs/strptime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ cdef dict _parse_code_table = {'y': 0,
'W': 16,
'Z': 17,
'p': 18, # an additional key, only with I
'z': 19}
'z': 19,
'G': 20,
'V': 21,
'u': 22}


def array_strptime(object[:] values, object fmt,
Expand All @@ -76,7 +79,8 @@ def array_strptime(object[:] values, object fmt,
int64_t[:] iresult
object[:] result_timezone
int year, month, day, minute, hour, second, weekday, julian
int week_of_year, week_of_year_start, parse_code, ordinal
int week_of_year, week_of_year_start, parse_code, ordinal,
iso_week, iso_year
int64_t us, ns
object val, group_key, ampm, found, timezone
dict found_key
Expand Down Expand Up @@ -169,13 +173,14 @@ def array_strptime(object[:] values, object fmt,
raise ValueError("time data %r does not match format "
"%r (search)" % (values[i], fmt))

iso_year = -1
year = 1900
month = day = 1
hour = minute = second = ns = us = 0
timezone = None
# Default to -1 to signify that values not known; not critical to have,
# though
week_of_year = -1
iso_week = week_of_year = -1
week_of_year_start = -1
# weekday and julian defaulted to -1 so as to signal need to calculate
# values
Expand Down Expand Up @@ -265,13 +270,43 @@ def array_strptime(object[:] values, object fmt,
timezone = pytz.timezone(found_dict['Z'])
elif parse_code == 19:
timezone = parse_timezone_directive(found_dict['z'])
elif parse_code == 20:
iso_year = int(found_dict['G'])
elif parse_code == 21:
iso_week = int(found_dict['V'])
elif parse_code == 22:
weekday = int(found_dict['u'])
weekday -= 1

# don't assume default values for ISO week/year
if iso_year != -1:
if iso_week == -1 or weekday == -1:
raise ValueError("ISO year directive '%G' must be used with "
"the ISO week directive '%V' and a weekday "
"directive '%A', '%a', '%w', or '%u'.")
if julian != -1:
raise ValueError("Day of the year directive '%j' is not "
"compatible with ISO year directive '%G'. "
"Use '%Y' instead.")
elif year != -1 and week_of_year == -1 and iso_week != -1:
if weekday == -1:
raise ValueError("ISO week directive '%V' must be used with "
"the ISO year directive '%G' and a weekday "
"directive '%A', '%a', '%w', or '%u'.")
else:
raise ValueError("ISO week directive '%V' is incompatible with"
" the year directive '%Y'. Use the ISO year "
"'%G' instead.")

# If we know the wk of the year and what day of that wk, we can figure
# out the Julian day of the year.
if julian == -1 and week_of_year != -1 and weekday != -1:
week_starts_Mon = True if week_of_year_start == 0 else False
julian = _calc_julian_from_U_or_W(year, week_of_year, weekday,
week_starts_Mon)
if julian == -1 and weekday != -1:
if week_of_year != -1:
week_starts_Mon = True if week_of_year_start == 0 else False
Copy link
Member

Choose a reason for hiding this comment

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

just week_starts_Mon = week_of_year_start == 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch!

julian = _calc_julian_from_U_or_W(year, week_of_year, weekday,
week_starts_Mon)
elif iso_year != -1 and iso_week != -1:
year, julian = _calc_julian_from_V(iso_year, iso_week, weekday + 1)
# Cannot pre-calculate datetime_date() since can change in Julian
# calculation and thus could have different value for the day of the wk
# calculation.
Expand Down Expand Up @@ -511,14 +546,17 @@ class TimeRE(dict):
# The " \d" part of the regex is to make %c from ANSI C work
'd': r"(?P<d>3[0-1]|[1-2]\d|0[1-9]|[1-9]| [1-9])",
'f': r"(?P<f>[0-9]{1,9})",
'G': r"(?P<G>\d\d\d\d)",
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure we have a doc-refernce to the strptime codes anywhere @mroeschke do you know?

Copy link
Member

Choose a reason for hiding this comment

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

Looks like the reference is here:

https://github.com/python/cpython/blob/master/Lib/_strptime.py

Copy link
Contributor

Choose a reason for hiding this comment

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

right so we have a doc reference anywhere though? eg in a doc string for Timestamp / to_datetime and / or in the docs proper?

Copy link
Member

Choose a reason for hiding this comment

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

'H': r"(?P<H>2[0-3]|[0-1]\d|\d)",
'I': r"(?P<I>1[0-2]|0[1-9]|[1-9])",
'j': (r"(?P<j>36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|"
r"[1-9]\d|0[1-9]|[1-9])"),
'm': r"(?P<m>1[0-2]|0[1-9]|[1-9])",
'M': r"(?P<M>[0-5]\d|\d)",
'S': r"(?P<S>6[0-1]|[0-5]\d|\d)",
'u': r"(?P<u>[1-7])",
'U': r"(?P<U>5[0-3]|[0-4]\d|\d)",
'V': r"(?P<V>5[0-3]|0[1-9]|[1-4]\d|\d)",
'w': r"(?P<w>[0-6])",
# W is set below by using 'U'
'y': r"(?P<y>\d\d)",
Expand Down Expand Up @@ -620,6 +658,25 @@ cdef _calc_julian_from_U_or_W(int year, int week_of_year,
return 1 + days_to_week + day_of_week


cdef _calc_julian_from_V(int iso_year, int iso_week, int iso_weekday):
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a more format doc-string (parameters / returns) sections

Copy link
Contributor

Choose a reason for hiding this comment

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

if you can update the other _calc_julian one would be great as well

"""Calculate the Julian day based on the ISO 8601 year, week, and weekday.
ISO weeks start on Mondays, with week 01 being the week containing 4 Jan.
ISO week days range from 1 (Monday) to 7 (Sunday)."""

cdef:
int correction, ordinal

correction = datetime_date(iso_year, 1, 4).isoweekday() + 3
ordinal = (iso_week * 7) + iso_weekday - correction
# ordinal may be negative or 0 now, which means the date is in the previous
# calendar year
if ordinal < 1:
ordinal += datetime_date(iso_year, 1, 1).toordinal()
iso_year -= 1
ordinal -= datetime_date(iso_year, 1, 1).toordinal()
return iso_year, ordinal


cdef parse_timezone_directive(object z):
"""
Parse the '%z' directive and return a pytz.FixedOffset
Expand Down
47 changes: 47 additions & 0 deletions pandas/tests/indexes/datetimes/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,53 @@ def test_to_datetime_parse_timezone_keeps_name(self):


class TestToDatetime(object):
@pytest.mark.parametrize("s, _format, dt", [
Copy link
Contributor

Choose a reason for hiding this comment

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

we should split up this file to segregate format parsing into a separate test file, cc @jbrockmendel, @mroeschke

['2015-1-1', '%G-%V-%u', datetime(2014, 12, 29, 0, 0)],
['2015-1-4', '%G-%V-%u', datetime(2015, 1, 1, 0, 0)],
['2015-1-7', '%G-%V-%u', datetime(2015, 1, 4, 0, 0)]
])
def test_to_datetime_iso_week_year_format(self, s, _format, dt):
assert to_datetime(s, format=_format) == dt

@pytest.mark.parametrize("msg, s, _format", [
["ISO week directive '%V' must be used with the ISO year directive "
"'%G' and a weekday directive '%A', '%a', '%w', or '%u'.", "1999 50",
"%Y %V"],
["ISO year directive '%G' must be used with the ISO week directive "
"'%V' and a weekday directive '%A', '%a', '%w', or '%u'.", "1999 51",
"%G %V"],
["ISO year directive '%G' must be used with the ISO week directive "
"'%V' and a weekday directive '%A', '%a', '%w', or '%u'.", "1999 "
"Monday", "%G %A"],
["ISO year directive '%G' must be used with the ISO week directive "
"'%V' and a weekday directive '%A', '%a', '%w', or '%u'.", "1999 Mon",
"%G %a"],
["ISO year directive '%G' must be used with the ISO week directive "
"'%V' and a weekday directive '%A', '%a', '%w', or '%u'.", "1999 6",
"%G %w"],
["ISO year directive '%G' must be used with the ISO week directive "
"'%V' and a weekday directive '%A', '%a', '%w', or '%u'.", "1999 6",
"%G %u"],
["ISO year directive '%G' must be used with the ISO week directive "
"'%V' and a weekday directive '%A', '%a', '%w', or '%u'.", "2051",
"%G"],
["Day of the year directive '%j' is not compatible with ISO year "
"directive '%G'. Use '%Y' instead.", "1999 51 6 256", "%G %V %u %j"],
["ISO week directive '%V' is incompatible with the year directive "
"'%Y'. Use the ISO year '%G' instead.", "1999 51 Sunday", "%Y %V %A"],
["ISO week directive '%V' is incompatible with the year directive "
"'%Y'. Use the ISO year '%G' instead.", "1999 51 Sun", "%Y %V %a"],
["ISO week directive '%V' is incompatible with the year directive "
"'%Y'. Use the ISO year '%G' instead.", "1999 51 1", "%Y %V %w"],
["ISO week directive '%V' is incompatible with the year directive "
"'%Y'. Use the ISO year '%G' instead.", "1999 51 1", "%Y %V %u"],
["ISO week directive '%V' must be used with the ISO year directive "
"'%G' and a weekday directive '%A', '%a', '%w', or '%u'.", "20", "%V"]
])
def test_ValueError_iso_week_year(self, msg, s, _format):
with pytest.raises(ValueError, message=msg):
to_datetime(s, format=_format)

@pytest.mark.parametrize('tz', [None, 'US/Central'])
def test_to_datetime_dtarr(self, tz):
# DatetimeArray
Expand Down