File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change
1
+ import copy
1
2
import functools
2
3
import itertools
3
4
from typing import Literal
@@ -227,16 +228,17 @@ def tableau(
227
228
table .rename (columns = {"index" : "colour" }, inplace = True )
228
229
229
230
# Default states for 2 or 3
230
- for i , state in enumerate (states ):
231
+ states_ = copy .deepcopy (states )
232
+ for i , state in enumerate (states_ ):
231
233
if isinstance (state , int ):
232
- states : list
234
+ states_ : list
233
235
if state == 2 :
234
- states [i ] = ["low" , "high" ]
236
+ states_ [i ] = ["low" , "high" ]
235
237
elif state == 3 :
236
- states [i ] = ["low" , "medium" , "high" ]
238
+ states_ [i ] = ["low" , "medium" , "high" ]
237
239
238
240
# get the list of states
239
- gen_states = [range (x ) if isinstance (x , int ) else x for x in states ]
241
+ gen_states = [range (x ) if isinstance (x , int ) else x for x in states_ ]
240
242
states_ = np .asarray (list (itertools .product (* gen_states )))
241
243
for i , var_name in enumerate (var_names ):
242
244
table .insert (loc = i + 1 , column = var_name , value = states_ [:, i ])
You can’t perform that action at this time.
0 commit comments