File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,13 @@ def vectors_to_arrays(vectors):
171
171
>>> all(isinstance(i, np.ndarray) for i in vectors_to_arrays(data))
172
172
True
173
173
174
+ >>> # Sequence of scalars are converted to 1-D arrays
175
+ >>> data = vectors_to_arrays([1, 2, 3.0])
176
+ >>> data
177
+ [array([1]), array([2]), array([3.])]
178
+ >>> [i.ndim for i in data] # Check that they are 1-D arrays
179
+ [1, 1, 1]
180
+
174
181
>>> import datetime
175
182
>>> import pytest
176
183
>>> pa = pytest.importorskip("pyarrow")
@@ -199,9 +206,7 @@ def vectors_to_arrays(vectors):
199
206
arrays = []
200
207
for vector in vectors :
201
208
vec_dtype = str (getattr (vector , "dtype" , "" ))
202
- array = np .asarray (a = vector , dtype = dtypes .get (vec_dtype ))
203
- arrays .append (np .ascontiguousarray (array ))
204
-
209
+ arrays .append (np .ascontiguousarray (vector , dtype = dtypes .get (vec_dtype )))
205
210
return arrays
206
211
207
212
You can’t perform that action at this time.
0 commit comments