I was printing one list of values in Python, when I got this:
[ 0.00020885 0.00021386 0.0002141 ..., 0.0501399 0.12051606
0.12359095]
What is the problem here? The list should have at least size 20. What happened to the elements shown as ...
?
If you work with NumPy, then you can use ... to abbreviate your slicing syntax by replacing variable-length dimensions with the Ellipsis object. With the clutter-free syntax that the three dots provide, you can make your code more readable.
The trailing comma distinguishes a one-element tuple from a parenthesized n . In a dimension entry, instructs NumPy to choose the length that will keep the total number of array elements the same.
The ellipsis is used in numpy to slice higher-dimensional data structures. It's designed to mean at this point, insert as many full slices ( : ) to extend the multi-dimensional slice to all dimensions.
The problem is that you are not printing a Python list, but a NumPy array. NumPy output can be configured using numpy.set_printoptions()
.
Data types matter. If you wonder about the behaviour of some object, first check its type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With