python - NumPy Histogram - ValueError range parameter must be finite - input array is okay -


i'm struggling understand error, since i'll give example that's working , 1 i'm interested in that's not.

i have analyse set of data hourly prices entire year in it, called sys_prices, - after various transformations - numpy.ndarray object 8785 rows (1 column), , every row numpy.ndarray item 1 element, numpy.float64 number.

the code not working following:

stop_day = 95 start_day = stop_day - 10 # 10 days before stop_day = (stop_day-1)*24 start_day = (start_day-1)*24  pcs=[] # list of prices analyse ii in range(start_day, stop_day):     pcs.append(sys_prices[ii][0])  p, x = np.histogram(pcs, bins='fd')  

the *24 part tune index within dataset respect hourly resolution.

what expect supply list pcs histogram method, values of histogram , bin edges p , x, respectively.

i expect because following code works:

start_day = 1  start_month = 1  start_year = 2016  stop_day = 1 stop_month = 2  stop_year = 2016 num_prices = (date(stop_year, stop_month, stop_day) - date(start_year, start_month, start_day)).days*24  jan_prices = [] ii in range(num_prices):     jan_prices.append(sys_prices[ii][0])  p, x = np.histogram(jan_prices, bins='fd') # bin data` 

the difference in codes working 1 analyzing 10 days within arbitrary period starting backwards chosen day of year, while working example uses prices in month of january (eg. first 744 values of dataset).

strange(r) thing: used different values stop_day, , seems 95 raises error, while 99 or 100 or 200 don't.

could me?

i solved it, there single nan in dataset couldn't spot.

for wondering how spot it, used code find index of item:

nanlist=[] ii in range(len(array)):     if numpy.isnan(array[ii]):         nanlist.append(ii) 

where array container.


Comments