在 Python 中使用 Dataset 模块时没有冻结属性 [英] No freeze attribute when using Dataset module in Python
问题描述
我目前正在尝试实施某种形式的 Twitter 数据分析.我已经启动并运行了使用 Streaming API 提取数据的代码,我所要做的就是将数据保存在 csv 文件中.
I'm currently trying to implement a form of twitter data analysis. I've already got a code up and running to pull data using the Streaming API, and all I have to do is save the data in a csv file.
result = db[settings.TABLE_NAME].all()
dataset.freeze(result, format='csv', filename=settings.CSV_NAME)
从我在文档中看到的,这应该是声明这一点的正确方式.我在另一个文件 settings.py 中定义了 Table.Name
和 CSV_Name
.
From what I saw in the documentation, this should be the right way of declaring this. I've defined Table.Name
and CSV_Name
in another file settings.py.
当运行 python dump.py
时,它给了我这个错误.
When running python dump.py
, it gives me this error.
AttributeError: module 'dataset' has no attribute 'freeze'
我正在尝试从 Streaming Data 复制代码,如果这有助于查明问题.我已将存储库克隆到我的桌面,并且只添加了我的 Twitter 身份验证数据.
I'm trying to replicate the code from Streaming Data, if that helps pinpoint the issue. I've cloned the repo to my Desktop, and only added my Twitter authentication data.
推荐答案
从数据集 1.0 版本开始,模块数据集被拆分为两个包,数据导出功能现在被提取到一个独立的包 datafreeze 中.
As of version dataset 1.0, module dataset is split into two packages, with the data export features now extracted into a stand-alone package, datafreeze.
所以安装datafreeze
pip install datafreeze
然后
from datafreeze import freeze
或
from datafreeze.app import freeze
两者都应该有效.
这篇关于在 Python 中使用 Dataset 模块时没有冻结属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!