问题
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