尝试在 ipython 中运行此文件时,我不断收到不同的属性错误...熊猫初学者,所以也许我遗漏了一些东西
代码:
from pandas import Series, DataFrame
import pandas as pd
import json
nan=float('NaN')
data = []
with open('file.json') as f:
for line in f:
data.append(json.loads(line))
df = DataFrame(data, columns=['accepted', 'user', 'object', 'response'])
clean = df.replace('NULL', nan)
clean = clean.dropna()
print clean.value_counts()
AttributeError: 'DataFrame' object has no attribute 'value_counts'
有任何想法吗?