No freeze attribute when using Dataset module in Python

╄→尐↘猪︶ㄣ 提交于 2019-12-11 05:00:56

问题


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)

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.

When running python dump.py, it gives me this error.

AttributeError: module 'dataset' has no attribute 'freeze'

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:


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.

So install datafreeze

pip install datafreeze

Then

from datafreeze import freeze

or

from datafreeze.app import freeze

Both should work.



来源:https://stackoverflow.com/questions/48090148/no-freeze-attribute-when-using-dataset-module-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!