(x, ndim)
| 4538 | # or NUMPY_LICENSE.txt within this directory |
| 4539 | |
| 4540 | def atleast_nd(x, ndim): |
| 4541 | x = asanyarray(x) |
| 4542 | diff = max(ndim - x.ndim, 0) |
| 4543 | if diff == 0: |
| 4544 | return x |
| 4545 | else: |
| 4546 | return x[(None,) * diff + (Ellipsis,)] |
| 4547 | |
| 4548 | def format_index(index): |
| 4549 | return "arrays" + "".join(f"[{i}]" for i in index) |
no test coverage detected