mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Imposed order on pandas dataframe
The Travis CI test on Python 3.5 kept reordering the dataframe so that the results wouldn't match. For that reason, I had to impose the order of the columns with a clunky process: -drop the column of surfaces from whatever location it's in -reinsert the column of surfaces where I want it to be
This commit is contained in:
parent
979317f614
commit
4aa478f17b
1 changed files with 5 additions and 2 deletions
|
|
@ -6239,14 +6239,17 @@ class SurfaceMGXS(MGXS):
|
|||
df = df[df['group out'].isin(groups)]
|
||||
|
||||
mesh_str = 'mesh {0}'.format(self.domain.id)
|
||||
surfaces = df[(mesh_str,'surf')]
|
||||
df.drop(columns=[(mesh_str,'surf')],inplace=True)
|
||||
df.insert(len(self.domain.dimension),(mesh_str,'surf'),surfaces)
|
||||
if len(self.domain.dimension) == 1:
|
||||
df.sort_values(by=[(mesh_str, 'x'), (mesh_str, 'surf')]
|
||||
+ columns, inplace=True)
|
||||
elif len(self.domain.dimension) == 2:
|
||||
df.sort_values(by=[(mesh_str, 'x'), (mesh_str, 'y'),
|
||||
df.sort_values(by=[(mesh_str, 'x'), (mesh_str, 'y'),
|
||||
(mesh_str, 'surf')] + columns, inplace=True)
|
||||
elif len(self.domain.dimension) == 3:
|
||||
df.sort_values(by=[(mesh_str, 'x'), (mesh_str, 'y'),
|
||||
df.sort_values(by=[(mesh_str, 'x'), (mesh_str, 'y'),
|
||||
(mesh_str, 'z'), (mesh_str, 'surf')] + columns, inplace=True)
|
||||
|
||||
return df
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue