春雨里洗过的太阳

世间所有的相遇,都是久别重逢

Python随笔

1 jupyter 安装多内核

1
2
3
4
5
6
7
# 如3.6 前提安装好anaconda和jupyter
1: conda create -n py3.6 python=3.6
2: conda activate py3.6 (退出 conda deactivate)
3: pip install ipykernel -i https://pypi.tuna.tsinghua.edu.cn/simple
4: conda deactivat
5: python -m ipykernel install --name py3.6 (退出虚拟环境后运行)
ps卸载内核: jupyter kernelspec remove py3.6

2 pip install name 指定源

1
pip install name -i https://pypi.tuna.tsinghua.edu.cn/simple

3 Excel xlsx file; not supported

1
2
1:pip uninstall xlrd
2:pip install xlrd=='1.2.0' -i https://pypi.tuna.tsinghua.edu.cn/simple

4 pandas报DataFrame object has no attribute ‘as_matrix’解决办法

1
2
3
NDFrame.as_matrix is deprecated. Use NDFrame.values instead (:issue:18458).
在新版中as_matrix 已被移除
使用df.values 替代