LoginSignup
0
0

More than 5 years have passed since last update.

Numpy: fliplr() > ValueError: Input must be >= 2-d. > 1次元のarrayにはエラーを出す

Last updated at Posted at 2017-12-02

numpy.fliplr
Flip array in the left/right direction.

ValueError: Input must be >= 2-d.

https://ideone.com/xd3w1U (Python 3.5)

import numpy as np

xs = [[3, 1, 4], [1, 5, 9]]
res = np.fliplr(xs)
print(res)

xs = [3, 1, 4]
res = np.fliplr(xs)
print(res)
run
[[4 1 3]
 [9 5 1]]
stderr
Traceback (most recent call last):
  File "./prog.py", line 4, in <module>
  File "/usr/lib/python3/dist-packages/numpy/lib/twodim_base.py", line 81, in fliplr
    raise ValueError("Input must be >= 2-d.")
ValueError: Input must be >= 2-d.

エラーの詳細

153行あたり

    if m.ndim < 2:
        raise ValueError, "Input must >= 2-d."

このエラーが出ているようだ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0