Fixture for indices with missing values. Integer-dtype and empty cases are excluded because they cannot hold missing values. MultiIndex is excluded because isna() is not defined for MultiIndex.
(request)
| 773 | ] |
| 774 | ) |
| 775 | def index_with_missing(request): |
| 776 | """ |
| 777 | Fixture for indices with missing values. |
| 778 | |
| 779 | Integer-dtype and empty cases are excluded because they cannot hold missing |
| 780 | values. |
| 781 | |
| 782 | MultiIndex is excluded because isna() is not defined for MultiIndex. |
| 783 | """ |
| 784 | ind = indices_dict[request.param] |
| 785 | if request.param in ["tuples", "mi-with-dt64tz-level", "multi"]: |
| 786 | # For setting missing values in the top level of MultiIndex |
| 787 | vals = ind.tolist() |
| 788 | vals[0] = (None, *vals[0][1:]) |
| 789 | vals[-1] = (None, *vals[-1][1:]) |
| 790 | return MultiIndex.from_tuples(vals) |
| 791 | else: |
| 792 | vals = ind.values.copy() |
| 793 | vals[0] = None |
| 794 | vals[-1] = None |
| 795 | return type(ind)(vals, copy=False) |
| 796 | |
| 797 | |
| 798 | # ---------------------------------------------------------------- |
nothing calls this directly
no test coverage detected