天道酬勤,学无止境

No freeze attribute when using Dataset module in Python

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.

评论

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.

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐