- datatime 处理方法
- useCols 节省内存
- skip rows 抽样
df = pd.read_csv(
filename,
header=0,
skiprows=lambda i: i>0 and random.random() > p
)
import pandas as pd
import numpy as np
filename = 'hugedatafile.csv'
nlinesfile = 10000000
nlinesrandomsample = 10000
lines2skip = np.random.choice(np.arange(1,nlinesfile+1), (nlinesfile-nlinesrandomsample), replace=False)
df = pd.read_csv(filename, skiprows=lines2skip)
- exec+ groupby
- 分层抽样
- 用于去重(一维使用value_counts())
- 用于拆分数据
- 搭配apply处理复杂数据
- map 一个dict,map一个匿名函数