-4

data = data.get('aggs')[0].get('subreddit')

df = pandas.DataFrame.from_records(data)[0:10]

1 Answers1

0

You'll need to import the packages (or modules) used in your code:

import requests
import pandas # this is missing from the article you referred to

Also, if you haven't installed Plotly, you'll want to do that with either pip install plotly or conda install plotly.

There are several good articles about import and Python modules/packages, such as https://www.devdungeon.com/content/python-import-syspath-and-pythonpath-tutorial or How to import other Python files?

David Gaertner
  • 386
  • 2
  • 7