python - Dask error: Length of values does not match length of index -


i have read csv file using dask way:

import dask.dataframe  dd train = dd.read_csv('act_train.csv') 

then apply simple logic per row , works pretty fine in pandas:

columns = list(train.columns)  col in columns[1:]:     train[col] = train[col].apply(lambda x: x if x == -1 else x.split(' ')[1]) 

unfortunately, last line of code generates following error: length of values not match length of index

what doing wrong?

if x doesn't contain space character x.split(' ') return list containing single element x.

so, when u trying access second element of x.split(' ') calling x.split(' ')[1]. give error :

"length of values not match length of index", there no element @ index 1 in x.split(' ').


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -