Re: IndexError for using pandas dataframe values

2016-05-28 Thread Peter Otten
Peter Otten wrote: > Daiyue Weng wrote: > >> Hi, I tried to use DataFrame.values to convert a list of columns in a >> dataframe to a numpy ndarray/matrix, >> >> matrix = df.values[:, list_of_cols] >> >> but got an error, >> >> IndexError: only integers, slices (:), ellipsis (...), numpy.newaxi

Re: IndexError for using pandas dataframe values

2016-05-25 Thread Peter Otten
Daiyue Weng wrote: > Hi, I tried to use DataFrame.values to convert a list of columns in a > dataframe to a numpy ndarray/matrix, > > matrix = df.values[:, list_of_cols] > > but got an error, > > IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis > (None) and integer or boolea

IndexError for using pandas dataframe values

2016-05-25 Thread Daiyue Weng
Hi, I tried to use DataFrame.values to convert a list of columns in a dataframe to a numpy ndarray/matrix, matrix = df.values[:, list_of_cols] but got an error, IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices so what's