记录使用python进行数据分析的一些方法。
系统环境:macOS
环境安装
安装Anaconda:https://www.anaconda.com/
pip 换源
为pip更换国内镜像源:
1 2 3 4
| python -m pip install --upgrade pip
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
|
如果想临时使用其他源:
1 2
| pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
|
如有需要也可以配置多个镜像源。
1 2
| pip config set global.extra-index-url "<url1> <url2>..."
|
How-to
统计表列中词语出现的次数
1 2 3 4 5 6 7 8 9 10 11 12
| import pandas as pd s = pd.Series(['Gokuldham society','db society','db colony','vasant nagar']) s.str.split(expand=True).stack().value_counts()
|