Why I keep getting this error on Labels?
# Appending Clustered Labels
#neighborhoods_venues_sorted.insert(0, 'Cluster Labels', kmeans.labels_)
lahore_merged = df_data_0
# add clustering labels
lahore_merged['Labels'] = kmeans.labels_
lahore_merged = lahore_merged.join(neighborhoods_venues_sorted.set_index('Neighborhood'), on='Neighborhood')
lahore_merged.head() # check the last columns!
ValueError: Length of values does not match length of index
Complete error message would be useful but at a first look, it looks like the index of the lahore_merged
and the length of kmeans.labels_
are different. Can you check that they are the same?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.