包含三个子集和14个元组的列表,仅算作三个值

时间:2019-04-28 12:57:30

标签: python machine-learning

我创建了一个包含三列所有唯一性的列表,应该是包含14个值的列表,但是,当我创建一个新的DataFrame时,它被视为三个值。

`names_cat= 
((df_cat.sex.unique(),df_cat.generation.unique(),df_cat.age.unique()))
names_cat=list(np.array(names_cat))
names_cat`

`[[male, female]
 Categories (2, object): [male, female],
 [Generation X, Silent, G.I. Generation, Boomers, Millenials, Generation 
 Z]
 Categories (6, object): [Generation X, Silent, G.I. Generation, Boomers, 
 Millenials, Generation Z],
 [15-24 years, 35-54 years, 75+ years, 25-34 years, 55-74 years, 5-14 
 years]
 Categories (6, object): [15-24 years, 35-54 years, 75+ years, 25-34 
 years, 55-74 years, 5-14 years]]`

`df_cat_processed=pd.DataFrame((df_cat_coded),columns=(names_cat))`
`ValueError: Shape of passed values is (14, 27820), indices imply (3, 
27820)`

0 个答案:

没有答案