File tree 3 files changed +12
-3
lines changed
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import pandas as pd
4
4
from pandas import (
5
+ Categorical ,
5
6
DataFrame ,
6
7
MultiIndex ,
7
8
Series ,
@@ -31,6 +32,9 @@ def setup(self):
31
32
self .dict_list = frame .to_dict (orient = "records" )
32
33
self .data2 = {i : {j : float (j ) for j in range (100 )} for i in range (2000 )}
33
34
35
+ # arrays which we wont consolidate
36
+ self .dict_of_categoricals = {i : Categorical (np .arange (N )) for i in range (K )}
37
+
34
38
def time_list_of_dict (self ):
35
39
DataFrame (self .dict_list )
36
40
@@ -50,6 +54,10 @@ def time_nested_dict_int64(self):
50
54
# nested dict, integer indexes, regression described in #621
51
55
DataFrame (self .data2 )
52
56
57
+ def time_dict_of_categoricals (self ):
58
+ # dict of arrays that we wont consolidate
59
+ DataFrame (self .dict_of_categoricals )
60
+
53
61
54
62
class FromSeries :
55
63
def setup (self ):
Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ def arrays_to_mgr(
129
129
130
130
else :
131
131
index = ensure_index (index )
132
+ arrays = [extract_array (x , extract_numpy = True ) for x in arrays ]
132
133
133
134
# Reached via DataFrame._from_arrays; we do validation here
134
135
for arr in arrays :
Original file line number Diff line number Diff line change @@ -1809,21 +1809,21 @@ def create_block_manager_from_blocks(
1809
1809
1810
1810
1811
1811
def create_block_manager_from_column_arrays (
1812
- arrays ,
1812
+ arrays : list [ ArrayLike ] ,
1813
1813
axes : list [Index ],
1814
1814
consolidate : bool = True ,
1815
1815
) -> BlockManager :
1816
1816
# Assertions disabled for performance (caller is responsible for verifying)
1817
1817
# assert isinstance(axes, list)
1818
1818
# assert all(isinstance(x, Index) for x in axes)
1819
+ # assert all(isinstance(x, (np.ndarray, ExtensionArray)) for x in arrays)
1820
+ # assert all(type(x) is not PandasArray for x in arrays)
1819
1821
# assert all(x.ndim == 1 for x in arrays)
1820
1822
# assert all(len(x) == len(axes[1]) for x in arrays)
1821
1823
# assert len(arrays) == len(axes[0])
1822
1824
# These last three are sufficient to allow us to safely pass
1823
1825
# verify_integrity=False below.
1824
1826
1825
- arrays = [extract_array (x , extract_numpy = True ) for x in arrays ]
1826
-
1827
1827
try :
1828
1828
blocks = _form_blocks (arrays , consolidate )
1829
1829
mgr = BlockManager (blocks , axes , verify_integrity = False )
You can’t perform that action at this time.
0 commit comments