Skip to content

Commit e992969

Browse files
authored
PERF: DataFrame.T (#44724)
1 parent 01e0052 commit e992969

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pandas/core/internals/construction.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def ndarray_to_mgr(
295295
copy_on_sanitize = False if typ == "array" else copy
296296

297297
vdtype = getattr(values, "dtype", None)
298-
if is_1d_only_ea_dtype(vdtype) or isinstance(dtype, ExtensionDtype):
298+
if is_1d_only_ea_dtype(vdtype) or is_1d_only_ea_dtype(dtype):
299299
# GH#19157
300300

301301
if isinstance(values, (np.ndarray, ExtensionArray)) and values.ndim > 1:

pandas/tests/frame/test_constructors.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,16 @@
7070

7171

7272
class TestDataFrameConstructors:
73-
def test_constructor_from_2d_datetimearray(self):
73+
def test_constructor_from_2d_datetimearray(self, using_array_manager):
7474
dti = date_range("2016-01-01", periods=6, tz="US/Pacific")
7575
dta = dti._data.reshape(3, 2)
7676

7777
df = DataFrame(dta)
7878
expected = DataFrame({0: dta[:, 0], 1: dta[:, 1]})
7979
tm.assert_frame_equal(df, expected)
80+
if not using_array_manager:
81+
# GH#44724 big performance hit if we de-consolidate
82+
assert len(df._mgr.blocks) == 1
8083

8184
def test_constructor_dict_with_tzaware_scalar(self):
8285
# GH#42505

0 commit comments

Comments
 (0)