短网址的用户收集的匿名数据, 以.gov 或者.mil 结尾.
1. 时区计数:找到数据集中最常出现的时区(tz 字段)
3. 将时区计数多的时区分解为 windows 和非 windows 用户
数据准备
import json
path = 'datasets/bitly_usagov/example.txt'
records = [json.loads(line) for line in open(path)]
frame = pd.DataFrame(records)
print(frame.info())
# 输出
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 3560 entries, 0 to 3559
Data columns (total 18 columns):
_heartbeat_ 120 non-null float64
a 3440 non-null object
al 3094 non-null object
c 2919 non-null object
cy 2919 non-null object
g 3440 non-null object
gr 2919 non-null object
h 3440 non-null object
hc 3440 non