python - ValueError: 'object too deep for desired array' -


i have valueerror: 'object deep desired array' in python program. have error while using numpy.digitize.
think it's how use pandas dataframes:
keep simple (because done through external library), have list in program library needs dataframe this:

ts = range(1000) df = pandas.dataframe(ts) res = numpy.digitize(df.values, bins) 

but seems df.values array of lists instead of array of floats. mean:

array([[   0],    [   1],    [   2],    ...,     [997],    [998],    [999]], dtype=int64) 

help please, spent time on this.

try this:

numpy.digitize(df.iloc[:, 0], bins) 

you trying values whole dataframe. why 2d array. each row in array row of dataframe.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

css - Have a transparent when hover each images(not background) -