I have the following code: buckets = pd.DataFrame(sample.score.unique())
Which produces:
0
0 0.342
1 0.408
2 0.450
3 0.458
4 0.492
5 0.500
When I try to rename the column with buckets.rename(columns = {'0': 'score'}, inplace = True)
the column name 0
is not renamed to score
.
How can rename 0
to score
?
就您而言,只需删除列名上的引号
{0: 'scores'}
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.