0

If I load data, and ask

np.shape(data)

and the answer is (somenumber,) with no entry after the comma, does this mean the array is empty?

For instance, (151234,).

In this particular case, I am loading in a large dataset (5 GB) of pickled data, but I believe the array is empty.

Googled python empty array,

Gugu72
  • 2,052
  • 13
  • 35
Jimbo
  • 11
  • 1
  • 1
    no it just means it only has one dimension – Alexander Jul 17 '23 at 00:00
  • 2
    Related / possible duplicate: [What is the syntax rule for having trailing commas in tuple definitions?](https://stackoverflow.com/q/7992559/11082165), plus the fact that a tuple's `repr` is intended to be a valid tuple literal – Brian61354270 Jul 17 '23 at 00:02

1 Answers1

1

np.shape returns the shape of the array as a tuple of ints. (151234,) is simply a tuple with a single element.

A shape of (151234,) means that the array has one dimension, and that dimension has a size of 151234. It is not an empty array. An empty array would have a size of 0 along at least one of its dimensions.

user2357112
  • 260,549
  • 28
  • 431
  • 505
Brian61354270
  • 8,690
  • 4
  • 21
  • 43