Error with plt.hist(col_sz[col_sz<1000]) => TypeError: '<' not supported between instances of 'tuple' and 'int'


(Coral) #1

I was able to generate the histogram with plt.hist(row_sz)

However, I got the following error with plt.hist(col_sz[col_sz<1000])


TypeError Traceback (most recent call last)
in ()
----> 1 plt.hist(row_sz[row_sz<1000])

TypeError: ‘<’ not supported between instances of ‘tuple’ and ‘int’

I am running Python 3.6.4 :: Anaconda, Inc; Google Cloud
Machine type: n1-highmem-4 (4 vCPUs, 26 GB memory)
CPU platform : Intel Broadwell
GPUs: 1 x NVIDIA Tesla K80


(Nicolas Nonnengießer) #2

Hey coral, I ran into the same problem. Did you find any solution?


#4

Because you forgot to transform col_sz from tuple to array. You can adding this before your plotting code:

col_sz = np.asarray(col_sz)

or you can directly try this:

temp = np.asarray(row_sz)[np.where(np.asarray(row_sz)<1000)]
plt.hist(temp)