conftest.py 698 B

123456789101112131415161718192021222324252627
  1. import numpy as np
  2. import pytest
  3. from pandas import (
  4. Index,
  5. MultiIndex,
  6. )
  7. # Note: identical the "multi" entry in the top-level "index" fixture
  8. @pytest.fixture
  9. def idx():
  10. # a MultiIndex used to test the general functionality of the
  11. # general functionality of this object
  12. major_axis = Index(["foo", "bar", "baz", "qux"])
  13. minor_axis = Index(["one", "two"])
  14. major_codes = np.array([0, 0, 1, 2, 3, 3])
  15. minor_codes = np.array([0, 1, 0, 1, 0, 1])
  16. index_names = ["first", "second"]
  17. mi = MultiIndex(
  18. levels=[major_axis, minor_axis],
  19. codes=[major_codes, minor_codes],
  20. names=index_names,
  21. verify_integrity=False,
  22. )
  23. return mi