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