@@ -152,10 +152,12 @@ def from_frame(df, sort_rows=False, sort_columns=False, parse_header=False, unfo
152
152
columns Index of the dataframe unless argument unfold_last_axis_name is set to True.
153
153
sort_rows : bool, optional
154
154
Whether or not to sort the rows alphabetically (sorting is more efficient than not sorting).
155
- Not used if `cartesian_prod` is False. Defaults to False.
155
+ Must be False if `cartesian_prod` is set to True.
156
+ Defaults to False.
156
157
sort_columns : bool, optional
157
158
Whether or not to sort the columns alphabetically (sorting is more efficient than not sorting).
158
- Not used if `cartesian_prod` is False. Defaults to False.
159
+ Must be False if `cartesian_prod` is set to True.
160
+ Defaults to False.
159
161
parse_header : bool, optional
160
162
Whether or not to parse columns labels. Pandas treats column labels as strings.
161
163
If True, column labels are converted into int, float or boolean when possible. Defaults to False.
@@ -171,7 +173,8 @@ def from_frame(df, sort_rows=False, sort_columns=False, parse_header=False, unfo
171
173
cartesian_prod : bool, optional
172
174
Whether or not to expand the dataframe to a cartesian product dataframe as needed by LArray.
173
175
This is an expensive operation but is absolutely required if you cannot guarantee your dataframe is already
174
- well formed. Defaults to True.
176
+ well formed. If True, arguments `sort_rows` and `sort_columns` must be set to False.
177
+ Defaults to True.
175
178
176
179
Returns
177
180
-------
@@ -233,8 +236,8 @@ def from_frame(df, sort_rows=False, sort_columns=False, parse_header=False, unfo
233
236
fill_value = fill_value , ** kwargs )
234
237
else :
235
238
if sort_rows or sort_columns :
236
- import warnings
237
- warnings . warn ( 'sort_rows and sort_columns are not used when cartesian_prod is set to False' , stacklevel = 2 )
239
+ raise ValueError ( 'sort_rows and sort_columns cannot not be used when cartesian_prod is set to False. '
240
+ 'Please call the method sort_axes on the returned array to sort rows or columns' )
238
241
axes_labels = index_to_labels (df .index , sort = False )
239
242
240
243
# Pandas treats column labels as column names (strings) so we need to convert them to values
@@ -258,9 +261,12 @@ def df_aslarray(df, sort_rows=False, sort_columns=False, raw=False, parse_header
258
261
df : Pandas DataFrame
259
262
Input dataframe.
260
263
sort_rows : bool, optional
261
- Whether or not to sort the rows alphabetically (sorting is more efficient than not sorting). Defaults to False.
264
+ Whether or not to sort the rows alphabetically (sorting is more efficient than not sorting).
265
+ Must be False if `cartesian_prod` is set to True.
266
+ Defaults to False.
262
267
sort_columns : bool, optional
263
268
Whether or not to sort the columns alphabetically (sorting is more efficient than not sorting).
269
+ Must be False if `cartesian_prod` is set to True.
264
270
Defaults to False.
265
271
raw : bool, optional
266
272
Whether or not to consider the input dataframe as a raw dataframe, i.e. read without index at all.
@@ -275,7 +281,8 @@ def df_aslarray(df, sort_rows=False, sort_columns=False, raw=False, parse_header
275
281
cartesian_prod : bool, optional
276
282
Whether or not to expand the dataframe to a cartesian product dataframe as needed by LArray.
277
283
This is an expensive operation but is absolutely required if you cannot guarantee your dataframe is already
278
- well formed. Defaults to True.
284
+ well formed. If True, arguments `sort_rows` and `sort_columns` must be set to False.
285
+ Defaults to True.
279
286
280
287
Returns
281
288
-------
0 commit comments