MCPcopy
hub / github.com/pandas-dev/pandas / index_with_missing

Function index_with_missing

pandas/conftest.py:775–795  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

773 ]
774)
775def 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# ----------------------------------------------------------------

Callers

nothing calls this directly

Calls 3

tolistMethod · 0.45
from_tuplesMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected