Skip to content

Commit

Permalink
Correctly updating the dataframe (still chained assignment)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfullard committed Oct 22, 2024
1 parent f30f8fe commit 7262b47
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tardis/plasma/equilibrium/level_populations.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ def __calculate_boltzmann_factor(self, rates_matrix, species_id):

def solve(self):
normalized_level_boltzmann_factors = pd.DataFrame(
index=self.levels.index, columns=self.rates_matrices.columns
index=self.levels.index,
columns=self.rates_matrices.columns,
dtype=np.float64,
)

for species_id in self.rates_matrices.index:
normalized_level_boltzmann_factors.loc[species_id, :] = (
normalized_level_boltzmann_factors.loc[species_id, :].update(
expand_series(
self.rates_matrices.loc[species_id].apply(
lambda rates_matrix: self.__calculate_boltzmann_factor(
Expand Down

0 comments on commit 7262b47

Please sign in to comment.