@author jackzhenguo
@desc
@tag
@version
@date 2020/03/24
读入 IMDB-Movie-Data 数据集,1000行数据:
df = pd.read_csv("../input/imdb-data/IMDB-Movie-Data.csv")
df['Title']
打印 Title
列:
0 Guardians of the Galaxy
1 Prometheus
2 Split
3 Sing
4 Suicide Squad
...
995 Secret in Their Eyes
996 Hostel: Part II
997 Step Up 2: The Streets
998 Search Party
999 Nine Lives
Name: Title, Length: 1000, dtype: object
标题是由几个单词组成,用空格分隔。
df["words_count"] = df["Title"].str.count(" ") + 1
df[["Title","words_count"]]