【Python基础】101道Numpy、Pandas练习题,提升你的Python水平

机器学习初学者

共 971字,需浏览 2分钟

 ·

2021-02-22 11:22

无论是数据分析还是机器学习,数据的预处理必不可少。其中最常用、最基础的Python库非numpy和pandas莫属,很多初学者可能看了很多教程,但是很快就把用法忘光了。

光看不练假把式,今天向大家推荐三套感觉不错的练习题,感兴趣的同学可以练练手,挑战一下。

每套题都分四个Level的难度

Difficulty Level: L1

Q. Extract all odd numbers from arr

Input:

arr = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
Desired output:

#> array([1, 3, 5, 7, 9])

答案是隐藏的,点开Solution即可查看

# Input
arr = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

# Solution
arr[arr % 2 == 1]
#> array([1, 3, 5, 7, 9])

Numpy 练习题

https://www.machinelearningplus.com/python/101-numpy-exercises-python/

Pandas 练习题

https://www.machinelearningplus.com/python/101-pandas-exercises-python/

datatable 练习题

  • 工具包 datatable 的功能特征与 Pandas 非常类似,但更侧重于速度以及对大数据的支持。

https://www.machinelearningplus.com/data-manipulation/101-python-datatable-exercises-pydatatable/


往期精彩回顾





本站qq群704220115,加入微信群请扫码:

浏览 75
点赞
评论
收藏
分享

手机扫一扫分享

分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

分享
举报