101道Numpy、Pandas练习题

无论是数据分析还是机器学习,数据的预处理必不可少。
其中最常用、最基础的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 练习题

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

Pandas 练习题

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

datatable 练习题

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

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

Tags: