無論是數據分析還是機器學習,數據的預處理必不可少。
其中最常用、最基礎的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/