File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -352,15 +352,14 @@ def select(self, **kwargs) -> DataFrame:
352352 indexes = row_indexes ,
353353 )
354354
355+ set_index = None
355356 if "time" in fc .labels :
356357 set_index = SetIndex (values = fc .get_available_ids_for_label ("time" ))
357- else :
358- set_index = SetIndex (values = [])
359358
360- column_indexes = [
361- results_index ,
362- set_index ,
363- ]
359+ column_indexes = [results_index ]
360+ if set_index :
361+ column_indexes . append ( set_index )
362+
364363 if isinstance (fc , PropertyFieldsContainer ):
365364 column_indexes = [results_index ]
366365
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ def __init__(
152152
153153 def _evaluate_values (self ):
154154 """Evaluates the values of the MeshIndex."""
155- if self ._scoping_ref is not None :
155+ if self ._scoping_ref is not None and self . _scoping_ref () is not None :
156156 self ._values = self ._scoping_ref ().ids
157157 else :
158158 # Merge the fields container scoping
Original file line number Diff line number Diff line change @@ -116,6 +116,15 @@ def test_dataframe_select(df):
116116 # print(df2)
117117
118118
119+ def test_dataframe_select_no_set_index ():
120+ simulation = post .StaticMechanicalSimulation (examples .find_simple_bar ())
121+ df = simulation .mesh .coordinates
122+ df2 = df .select (components = "X" )
123+ assert len (df2 .index ) == 2
124+ assert df2 .index .components .values == ["X" ]
125+ assert len (df2 .mesh_index .values ) == len (df .mesh_index .values )
126+
127+
119128@pytest .mark .skipif (
120129 not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0 ,
121130 reason = "Fluid capabilities added with ansys-dpf-server 2024.1.pre0." ,
You can’t perform that action at this time.
0 commit comments