Hi all,
I recently had to do a clean reinstall of my system and for the most part everything seems to be working as expected, however previous Python analysis scripts now break when I try to use a line of code as below:
fuelTally = sp.get_tally(name = ‘FuelCell’)
fuelFlux = fuelTally.get_slice(scores=[‘flux’])
fuelFluxDF = fuelFlux.get_pandas_dataframe()
I get the following error, the entire error message is pasted below
ValueError: setting an array element with a sequence.
I am using anaconda and I had just built it using the base instructions that are provided in the OpenMC documentation for building your conda environment, which is what I thought I did last time but clearly something has changed. Hopefully someone has seen this same error and knows how to fix it.
I’m not sure if there’s some package that needs to be updated to make this work? It’s not particularly troublesome but it would be nice if I could use the dataframe format for the tally analysis. I have found a work around for the mean time.
Much appreciated.
Here is the entire error message
ValueError Traceback (most recent call last)
Cell In[17], line 3
1 # key = ‘energy high [eV]’
2 key = ‘energy low [eV]’
----> 3 fuelFluxDF = fuelFlux.get_pandas_dataframe()
4 fuelFluxSpectrumNorm = fuelFluxDF[‘mean’].to_numpy()
5 fuelFluxSpectrumNRGs = fuelFluxDF[‘energy high [eV]’].to_numpy()
6 # —File ~/anaconda3/envs/openmcENDF7_1/lib/python3.13/site-packages/openmc/tallies.py:1992, in Tally.get_pandas_dataframe(self, filters, nuclides, scores, derivative, paths, float_format)
1990 for i, column in enumerate(columns):
1991 if not isinstance(column, tuple):
→ 1992 columns[i] = (column,)
1994 # Make each tuple the same length
1995 max_len_column = len(max(columns, key=len))File ~/anaconda3/envs/openmcENDF7_1/lib/python3.13/site-packages/pandas/core/arrays/string_.py:871, in StringArray.__setitem__(self, key, value)
869 scalar_value = lib.is_scalar(value)
870 if scalar_key and not scalar_value:
→ 871 raise ValueError(“setting an array element with a sequence.”)
873 if not scalar_value:
874 if value.dtype == self.dtype:ValueError: setting an array element with a sequence.