如何在Netflix数据中使用LabelEncoder?

问题描述 投票:0回答:1

我有数据(Netflix中的电影),它包含3列movieId,标题和流派每部电影都可以分为两种或多种类型,例如:

    movieId             title                                       genres
0        1  Toy Story (1995)  Adventure|Animation|Children|Comedy|Fantasy

我想将每个流派放在一个拆分列中我首先通过此代码创建新列:

movie['types']= movie.genres.str.split( pat='|') 

然后我使用LabeEncoder,但是它不起作用我怎么能达到我的目标???

我有数据(Netflix中的电影),它包含3列movieId,标题和流派,每个电影都可以分为两种或更多流派,例如:movieId标题...

python pandas preprocessor
1个回答
0
投票

使用expand中的str.split参数:

© www.soinside.com 2019 - 2024. All rights reserved.