【发布时间】:2017-10-28 01:07:50
【问题描述】:
movie_rating_T.iloc[:,5:6]
critic Toby
title
Just My Luck NaN
Lady in the Water NaN
Snakes on a Plane 4.5
Superman Returns 4.0
The Night Listener NaN
You Me and Dupree 1.0
假设我只想选择 Nan 列
Just My Luck
Lady in the Water
The Night Listener
如何使用 dataframe nan 只提取 nan 值?
critic Toby
title
Just My Luck NaN
Lady in the Water NaN
The Night Listener NaN
.['title'] 不起作用
================================================ ================= movie_rating_T.iloc[:,5:6]
critic Toby
title
Just My Luck NaN
Lady in the Water NaN
Snakes on a Plane 4.5
Superman Returns 4.0
The Night Listener NaN
You Me and Dupree 1.0
df_MovieRatingT[df_MovieRatingT['Toby'].isnull()]
critic Toby
title
Just My Luck NaN
Lady in the Water NaN
The Night Listener NaN
================================================ ================ df = DataFrame(评级)
critic title rating
0 Jack Matthews Lady in the Water 3.0
1 Jack Matthews Snakes on a Plane 4.0
2 Jack Matthews You Me and Dupree 3.5
3 Jack Matthews Superman Returns 5.0
我想成功
critic Claudia Puig Gene Seymour Jack Matthews Lisa Rose Mick LaSalle Toby
title
Just My Luck 3.0 1.5 NaN 3.0 2.0 NaN
Lady in the Water NaN 3.0 3.0 2.5 3.0 NaN
Snakes on a Plane 3.5 3.5 4.0 3.5 4.0 4.5
Superman Returns 4.0 5.0 5.0 3.5 3.0 4.0
The Night Listener 4.5 3.0 3.0 3.0 3.0 NaN
You Me and Dupree 2.5 3.5 3.5 2.5 2.0 1.0
我用过
movie_rating= ratings.pivot(index='critic', columns='title',values='rating')
但它在同一列中创建了标题和评论家。 如何解决?
【问题讨论】: