Skip to content

Commit ad226c8

Browse files
author
=
committed
Merge remote-tracking branch 'upstream/main' into scott/bodo_udf_engine
2 parents 5711ad4 + 84bf1ef commit ad226c8

File tree

14 files changed

+33
-261
lines changed

14 files changed

+33
-261
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/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/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)

pandas/tests/frame/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def float_string_frame():
3333
df = DataFrame(
3434
np.random.default_rng(2).standard_normal((30, 4)),
3535
index=Index([f"foo_{i}" for i in range(30)], dtype=object),
36-
columns=Index(list("ABCD"), dtype=object),
36+
columns=Index(list("ABCD")),
3737
)
3838
df["foo"] = "bar"
3939
return df

pandas/tests/frame/constructors/test_from_dict.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ def test_constructor_list_of_series(self):
108108
expected = DataFrame.from_dict(sdict, orient="index")
109109
tm.assert_frame_equal(result, expected)
110110

111-
@pytest.mark.xfail(using_string_dtype(), reason="columns inferring logic broken")
112111
def test_constructor_orient(self, float_string_frame):
113112
data_dict = float_string_frame.T._series
114113
recons = DataFrame.from_dict(data_dict, orient="index")

pandas/tests/frame/test_block_internals.py

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import numpy as np
88
import pytest
99

10-
from pandas._config import using_string_dtype
11-
1210
import pandas as pd
1311
from pandas import (
1412
Categorical,
@@ -162,21 +160,7 @@ def test_constructor_with_convert(self):
162160
)
163161
tm.assert_series_equal(result, expected)
164162

165-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
166163
def test_construction_with_mixed(self, float_string_frame, using_infer_string):
167-
# test construction edge cases with mixed types
168-
169-
# f7u12, this does not work without extensive workaround
170-
data = [
171-
[datetime(2001, 1, 5), np.nan, datetime(2001, 1, 2)],
172-
[datetime(2000, 1, 2), datetime(2000, 1, 3), datetime(2000, 1, 1)],
173-
]
174-
df = DataFrame(data)
175-
176-
# check dtypes
177-
result = df.dtypes
178-
expected = Series({"datetime64[us]": 3})
179-
180164
# mixed-type frames
181165
float_string_frame["datetime"] = datetime.now()
182166
float_string_frame["timedelta"] = timedelta(days=1, seconds=1)
@@ -196,13 +180,11 @@ def test_construction_with_mixed(self, float_string_frame, using_infer_string):
196180
)
197181
tm.assert_series_equal(result, expected)
198182

199-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
200183
def test_construction_with_conversions(self):
201184
# convert from a numpy array of non-ns timedelta64; as of 2.0 this does
202185
# *not* convert
203186
arr = np.array([1, 2, 3], dtype="timedelta64[s]")
204-
df = DataFrame(index=range(3))
205-
df["A"] = arr
187+
df = DataFrame({"A": arr})
206188
expected = DataFrame(
207189
{"A": pd.timedelta_range("00:00:01", periods=3, freq="s")}, index=range(3)
208190
)
@@ -220,11 +202,11 @@ def test_construction_with_conversions(self):
220202
assert expected.dtypes["dt1"] == "M8[s]"
221203
assert expected.dtypes["dt2"] == "M8[s]"
222204

223-
df = DataFrame(index=range(3))
224-
df["dt1"] = np.datetime64("2013-01-01")
225-
df["dt2"] = np.array(
205+
dt1 = np.datetime64("2013-01-01")
206+
dt2 = np.array(
226207
["2013-01-01", "2013-01-02", "2013-01-03"], dtype="datetime64[D]"
227208
)
209+
df = DataFrame({"dt1": dt1, "dt2": dt2})
228210

229211
# df['dt3'] = np.array(['2013-01-01 00:00:01','2013-01-01
230212
# 00:00:02','2013-01-01 00:00:03'],dtype='datetime64[s]')
@@ -401,14 +383,17 @@ def test_update_inplace_sets_valid_block_values():
401383
assert isinstance(df._mgr.blocks[0].values, Categorical)
402384

403385

404-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
405386
def test_nonconsolidated_item_cache_take():
406387
# https://github.com/pandas-dev/pandas/issues/35521
407388

408389
# create non-consolidated dataframe with object dtype columns
409-
df = DataFrame()
410-
df["col1"] = Series(["a"], dtype=object)
390+
df = DataFrame(
391+
{
392+
"col1": Series(["a"], dtype=object),
393+
}
394+
)
411395
df["col2"] = Series([0], dtype=object)
396+
assert not df._mgr.is_consolidated()
412397

413398
# access column (item cache)
414399
df["col1"] == "A"

0 commit comments

Comments
 (0)