Skip to content

Commit 59a5ceb

Browse files
committed
Merge branch 'main' into lock-block-values-refs
2 parents defbcc0 + 84bf1ef commit 59a5ceb

File tree

18 files changed

+63
-271
lines changed

18 files changed

+63
-271
lines changed

.circleci/config.yml

Lines changed: 0 additions & 155 deletions
This file was deleted.

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ pandas/_version.py export-subst
6161
*.pxi export-ignore
6262

6363
# Ignoring stuff from the top level
64-
.circleci export-ignore
6564
.github export-ignore
6665
asv_bench export-ignore
6766
ci export-ignore

ci/code_checks.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,13 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
146146
-i "pandas.tseries.offsets.CustomBusinessMonthBegin PR02" \
147147
-i "pandas.tseries.offsets.CustomBusinessMonthBegin.calendar GL08" \
148148
-i "pandas.tseries.offsets.CustomBusinessMonthBegin.holidays GL08" \
149-
-i "pandas.tseries.offsets.CustomBusinessMonthBegin.is_on_offset SA01" \
150149
-i "pandas.tseries.offsets.CustomBusinessMonthBegin.m_offset GL08" \
151150
-i "pandas.tseries.offsets.CustomBusinessMonthBegin.n GL08" \
152151
-i "pandas.tseries.offsets.CustomBusinessMonthBegin.normalize GL08" \
153152
-i "pandas.tseries.offsets.CustomBusinessMonthBegin.weekmask GL08" \
154153
-i "pandas.tseries.offsets.CustomBusinessMonthEnd PR02" \
155154
-i "pandas.tseries.offsets.CustomBusinessMonthEnd.calendar GL08" \
156155
-i "pandas.tseries.offsets.CustomBusinessMonthEnd.holidays GL08" \
157-
-i "pandas.tseries.offsets.CustomBusinessMonthEnd.is_on_offset SA01" \
158156
-i "pandas.tseries.offsets.CustomBusinessMonthEnd.m_offset GL08" \
159157
-i "pandas.tseries.offsets.CustomBusinessMonthEnd.n GL08" \
160158
-i "pandas.tseries.offsets.CustomBusinessMonthEnd.normalize GL08" \
@@ -191,7 +189,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
191189
-i "pandas.tseries.offsets.Hour.is_on_offset GL08" \
192190
-i "pandas.tseries.offsets.Hour.n GL08" \
193191
-i "pandas.tseries.offsets.Hour.normalize GL08" \
194-
-i "pandas.tseries.offsets.LastWeekOfMonth SA01" \
195192
-i "pandas.tseries.offsets.LastWeekOfMonth.is_on_offset GL08" \
196193
-i "pandas.tseries.offsets.LastWeekOfMonth.n GL08" \
197194
-i "pandas.tseries.offsets.LastWeekOfMonth.normalize GL08" \

ci/deps/circle-311-arm64.yaml

Lines changed: 0 additions & 61 deletions
This file was deleted.

doc/source/getting_started/tutorials.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Various tutorials
112112

113113
* `Wes McKinney's (pandas BDFL) blog <https://wesmckinney.com/archives.html>`_
114114
* `Statistical analysis made easy in Python with SciPy and pandas DataFrames, by Randal Olson <http://www.randalolson.com/2012/08/06/statistical-analysis-made-easy-in-python/>`_
115-
* `Statistical Data Analysis in Python, tutorial videos, by Christopher Fonnesbeck from SciPy 2013 <https://conference.scipy.org/scipy2013/tutorial_detail.php?id=109>`_
115+
* `Statistical Data Analysis in Python, tutorial by Christopher Fonnesbeck from SciPy 2013 <https://github.com/fonnesbeck/statistical-analysis-python-tutorial>`_
116116
* `Financial analysis in Python, by Thomas Wiecki <https://nbviewer.org/github/twiecki/financial-analysis-python-tutorial/blob/master/1.%20Pandas%20Basics.ipynb>`_
117117
* `Intro to pandas data structures, by Greg Reda <http://www.gregreda.com/2013/10/26/intro-to-pandas-data-structures/>`_
118118
* `Pandas DataFrames Tutorial, by Karlijn Willems <https://www.datacamp.com/community/tutorials/pandas-tutorial-dataframe-python>`_

pandas/_libs/tslibs/offsets.pyx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,24 @@ cdef class BaseOffset:
720720
"""
721721
Return boolean whether a timestamp intersects with this frequency.
722722

723+
This method determines if a given timestamp aligns with the start
724+
of a custom business month, as defined by this offset. It accounts
725+
for custom rules, such as skipping weekends or other non-business days,
726+
and checks whether the provided datetime falls on a valid business day
727+
that marks the beginning of the custom business month.
728+
723729
Parameters
724730
----------
725731
dt : datetime.datetime
726732
Timestamp to check intersections with frequency.
727733

734+
See Also
735+
--------
736+
tseries.offsets.CustomBusinessMonthBegin : Represents the start of a custom
737+
business month.
738+
tseries.offsets.CustomBusinessMonthEnd : Represents the end of a custom
739+
business month.
740+
728741
Examples
729742
--------
730743
>>> ts = pd.Timestamp(2022, 1, 1)
@@ -3710,6 +3723,15 @@ cdef class LastWeekOfMonth(WeekOfMonthMixin):
37103723
- 5 is Saturday
37113724
- 6 is Sunday.
37123725
3726+
See Also
3727+
--------
3728+
tseries.offsets.WeekOfMonth :
3729+
Date offset for a specific weekday in a month.
3730+
tseries.offsets.MonthEnd :
3731+
Date offset for the end of the month.
3732+
tseries.offsets.BMonthEnd :
3733+
Date offset for the last business day of the month.
3734+
37133735
Examples
37143736
--------
37153737
>>> ts = pd.Timestamp(2022, 1, 1)

pandas/core/arrays/arrow/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ def _to_datetimearray(self) -> DatetimeArray:
13981398
np_dtype = np.dtype(f"M8[{pa_type.unit}]")
13991399
dtype = tz_to_dtype(pa_type.tz, pa_type.unit)
14001400
np_array = self._pa_array.to_numpy()
1401-
np_array = np_array.astype(np_dtype)
1401+
np_array = np_array.astype(np_dtype, copy=False)
14021402
return DatetimeArray._simple_new(np_array, dtype=dtype)
14031403

14041404
def _to_timedeltaarray(self) -> TimedeltaArray:
@@ -1409,7 +1409,7 @@ def _to_timedeltaarray(self) -> TimedeltaArray:
14091409
assert pa.types.is_duration(pa_type)
14101410
np_dtype = np.dtype(f"m8[{pa_type.unit}]")
14111411
np_array = self._pa_array.to_numpy()
1412-
np_array = np_array.astype(np_dtype)
1412+
np_array = np_array.astype(np_dtype, copy=False)
14131413
return TimedeltaArray._simple_new(np_array, dtype=np_dtype)
14141414

14151415
def _values_for_json(self) -> np.ndarray:

pandas/core/construction.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,8 @@ def sanitize_array(
596596
# create an extension array from its dtype
597597
_sanitize_non_ordered(data)
598598
cls = dtype.construct_array_type()
599+
if not hasattr(data, "__array__"):
600+
data = list(data)
599601
subarr = cls._from_sequence(data, dtype=dtype, copy=copy)
600602

601603
# GH#846

pandas/io/parsers/arrow_parser_wrapper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ def _finalize_pandas_output(self, frame: DataFrame) -> DataFrame:
165165
# The only way self.names is not the same length as number of cols is
166166
# if we have int index_col. We should just pad the names(they will get
167167
# removed anyways) to expected length then.
168-
self.names = list(range(num_cols - len(self.names))) + self.names
168+
columns_prefix = [str(x) for x in range(num_cols - len(self.names))]
169+
self.names = columns_prefix + self.names
169170
multi_index_named = False
170171
frame.columns = self.names
171172

pandas/tests/base/test_constructors.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,14 @@ def test_constructor_datetime_nonns(self, constructor):
179179
arr.flags.writeable = False
180180
result = constructor(arr)
181181
tm.assert_equal(result, expected)
182+
183+
def test_constructor_from_dict_keys(self, constructor, using_infer_string):
184+
# https://github.com/pandas-dev/pandas/issues/60343
185+
d = {"a": 1, "b": 2}
186+
result = constructor(d.keys(), dtype="str")
187+
if using_infer_string:
188+
assert result.dtype == "str"
189+
else:
190+
assert result.dtype == "object"
191+
expected = constructor(list(d.keys()), dtype="str")
192+
tm.assert_equal(result, expected)

0 commit comments

Comments
 (0)