Skip to content

Feature: improve MFD Series index #109

@chrisdicaprio

Description

@chrisdicaprio

The function solvis.solvis.mfd_hist retuns a pandas Series with a CategoricalInde for the bins. The index is only present for bins that are not empty, e.g.:

Magnitude
(7.0, 7.1]    0.000299
(7.3, 7.4]    0.000061
(7.5, 7.6]    0.000046
(7.6, 7.7]    0.000278
(7.7, 7.8]     0.00019
(7.8, 7.9]    0.000006
(7.9, 8.0]    0.000031
(8.0, 8.1]    0.000006
(8.1, 8.2]    0.000035
Name: Annual Rate, dtype: Float32

It can be handy to have the empty bins as well, such as when plotting the cumulative MFD. Propse we fill in the empty bins with 0.0 rate:

full_index = pd.CategoricalIndex(mfd.index.categories)
mfd = pd.Series(index=full_index, data=0) + mfd
mfd.fillna(0, inplace=True)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions