IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

27 Zeilen
850B

  1. from triacontagon.cumcount import dfill, \
  2. argunsort, \
  3. cumcount
  4. import numpy as np
  5. def test_dfill_01():
  6. input = np.array([1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5])
  7. output = dfill(input)
  8. expected = np.array([0, 0, 0, 0, 0, 5, 5, 7, 7, 7, 10, 10, 12, 12])
  9. assert np.all(output == expected)
  10. def test_argunsort_01():
  11. input = np.array([1, 1, 2, 3, 3, 4, 1, 1, 5, 5, 2, 3, 1, 4])
  12. output = np.argsort(input, kind='mergesort')
  13. output = argunsort(output)
  14. expected = np.array([0, 1, 5, 7, 8, 10, 2, 3, 12, 13, 6, 9, 4, 11])
  15. assert np.all(output == expected)
  16. def test_cumcount_01():
  17. input = np.array([1, 1, 2, 3, 3, 4, 1, 1, 5, 5, 2, 3, 1, 4])
  18. output = cumcount(input)
  19. expected = np.array([0, 1, 0, 0, 1, 0, 2, 3, 0, 1, 1, 2, 4, 1])
  20. assert np.all(output == expected)