Skip to content

Commit 2ebba1b

Browse files
authored
Merge branch 'main' into cow_set_flags
2 parents 450f629 + c4a84ab commit 2ebba1b

File tree

25 files changed

+409
-127
lines changed

25 files changed

+409
-127
lines changed

.github/workflows/macos-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
PANDAS_CI: 1
1717
PYTEST_TARGET: pandas
1818
PATTERN: "not slow and not db and not network and not single_cpu"
19-
TEST_ARGS: "-W error:::pandas"
19+
ERROR_ON_WARNINGS: "1"
2020

2121

2222
permissions:

.github/workflows/ubuntu.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: "Minimum Versions"
3939
env_file: actions-38-minimum_versions.yaml
4040
pattern: "not slow and not network and not single_cpu"
41-
test_args: ""
41+
error_on_warnings: "0"
4242
- name: "Locale: it_IT"
4343
env_file: actions-38.yaml
4444
pattern: "not slow and not network and not single_cpu"
@@ -63,20 +63,22 @@ jobs:
6363
env_file: actions-310.yaml
6464
pattern: "not slow and not network and not single_cpu"
6565
pandas_copy_on_write: "1"
66-
test_args: ""
66+
error_on_warnings: "0"
6767
- name: "Data Manager"
6868
env_file: actions-38.yaml
6969
pattern: "not slow and not network and not single_cpu"
7070
pandas_data_manager: "array"
71-
test_args: ""
71+
error_on_warnings: "0"
7272
- name: "Pypy"
7373
env_file: actions-pypy-38.yaml
7474
pattern: "not slow and not network and not single_cpu"
7575
test_args: "--max-worker-restart 0"
76+
error_on_warnings: "0"
7677
- name: "Numpy Dev"
7778
env_file: actions-310-numpydev.yaml
7879
pattern: "not slow and not network and not single_cpu"
7980
test_args: "-W error::DeprecationWarning:numpy -W error::FutureWarning:numpy"
81+
error_on_warnings: "0"
8082
exclude:
8183
- env_file: actions-38.yaml
8284
pyarrow_version: "7"
@@ -96,11 +98,12 @@ jobs:
9698
ENV_FILE: ci/deps/${{ matrix.env_file }}
9799
PATTERN: ${{ matrix.pattern }}
98100
EXTRA_APT: ${{ matrix.extra_apt || '' }}
101+
ERROR_ON_WARNINGS: ${{ matrix.error_on_warnings || '1' }}
99102
LANG: ${{ matrix.lang || '' }}
100103
LC_ALL: ${{ matrix.lc_all || '' }}
101104
PANDAS_DATA_MANAGER: ${{ matrix.pandas_data_manager || 'block' }}
102105
PANDAS_COPY_ON_WRITE: ${{ matrix.pandas_copy_on_write || '0' }}
103-
TEST_ARGS: ${{ matrix.test_args || '-W error:::pandas' }}
106+
TEST_ARGS: ${{ matrix.test_args || '' }}
104107
PYTEST_WORKERS: ${{ contains(matrix.pattern, 'not single_cpu') && 'auto' || '1' }}
105108
PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }}
106109
IS_PYPY: ${{ contains(matrix.env_file, 'pypy') }}

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ repos:
6363
'--extensions=c,h',
6464
'--headers=h',
6565
--recursive,
66-
'--filter=-readability/casting,-runtime/int,-build/include_subdir'
66+
--linelength=88,
67+
'--filter=-readability/casting,-runtime/int,-build/include_subdir,-readability/fn_size'
6768
]
6869
- repo: https://github.com/PyCQA/flake8
6970
rev: 6.0.0

ci/run_tests.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ if [[ "$PATTERN" ]]; then
3030
PYTEST_CMD="$PYTEST_CMD -m \"$PATTERN\""
3131
fi
3232

33+
if [[ "$ERROR_ON_WARNINGS" == "1" ]]; then
34+
for pth in $(find pandas -name '*.py' -not -path "pandas/tests/*" | sed -e 's/\.py//g' -e 's/\/__init__//g' -e 's/\//./g');
35+
do
36+
PYTEST_CMD="$PYTEST_CMD -W error:::$pth"
37+
done
38+
fi
39+
3340
echo $PYTEST_CMD
3441
sh -c "$PYTEST_CMD"
3542

doc/source/user_guide/io.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3833,7 +3833,7 @@ OpenDocument Spreadsheets
38333833
The io methods for `Excel files`_ also support reading and writing OpenDocument spreadsheets
38343834
using the `odfpy <https://pypi.org/project/odfpy/>`__ module. The semantics and features for reading and writing
38353835
OpenDocument spreadsheets match what can be done for `Excel files`_ using
3836-
``engine='odf'``.
3836+
``engine='odf'``. The optional dependency 'odfpy' needs to be installed.
38373837

38383838
The :func:`~pandas.read_excel` method can read OpenDocument spreadsheets
38393839

doc/source/whatsnew/v2.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Other enhancements
103103
- :meth:`DataFrame.plot.hist` now recognizes ``xlabel`` and ``ylabel`` arguments (:issue:`49793`)
104104
- Improved error message in :func:`to_datetime` for non-ISO8601 formats, informing users about the position of the first error (:issue:`50361`)
105105
- Improved error message when trying to align :class:`DataFrame` objects (for example, in :func:`DataFrame.compare`) to clarify that "identically labelled" refers to both index and columns (:issue:`50083`)
106+
- Performance improvement in :func:`to_datetime` when format is given or can be inferred (:issue:`50465`)
106107
-
107108

108109
.. ---------------------------------------------------------------------------

pandas/_libs/tslibs/np_datetime.pxd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,9 @@ cdef int64_t convert_reso(
120120
NPY_DATETIMEUNIT to_reso,
121121
bint round_ok,
122122
) except? -1
123+
124+
cdef extern from "src/datetime/np_datetime_strings.h":
125+
ctypedef enum FormatRequirement:
126+
PARTIAL_MATCH
127+
EXACT_MATCH
128+
INFER_FORMAT

pandas/_libs/tslibs/np_datetime.pyx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ cdef extern from "src/datetime/np_datetime_strings.h":
5353
npy_datetimestruct *out,
5454
NPY_DATETIMEUNIT *out_bestunit,
5555
int *out_local, int *out_tzoffset,
56-
const char *format, int format_len, int exact)
56+
const char *format, int format_len,
57+
FormatRequirement exact)
5758

5859

5960
# ----------------------------------------------------------------------
@@ -286,17 +287,20 @@ cdef int string_to_dts(
286287
const char* buf
287288
Py_ssize_t format_length
288289
const char* format_buf
290+
FormatRequirement format_requirement
289291

290292
buf = get_c_string_buf_and_size(val, &length)
291293
if format is None:
292294
format_buf = b""
293295
format_length = 0
294-
exact = False
296+
format_requirement = INFER_FORMAT
295297
else:
296298
format_buf = get_c_string_buf_and_size(format, &format_length)
299+
format_requirement = <FormatRequirement>exact
297300
return parse_iso_8601_datetime(buf, length, want_exc,
298301
dts, out_bestunit, out_local, out_tzoffset,
299-
format_buf, format_length, exact)
302+
format_buf, format_length,
303+
format_requirement)
300304

301305

302306
cpdef ndarray astype_overflowsafe(

0 commit comments

Comments
 (0)