Giter Site home page Giter Site logo

nilmolne / text-mining-the-new-york-times-articles Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 2.0 1.39 MB

Provides the tools needed to mine text from The New York Times online articles by using Python and a dictionary text mining technique, given a time range and country of interest.

Python 5.29% Jupyter Notebook 94.71%
text-mining data-science data-mining api python data-analysis economics journalism python-tutorial newyorktimes

text-mining-the-new-york-times-articles's People

Contributors

nilmolne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

laranea chedabd

text-mining-the-new-york-times-articles's Issues

AttributeError: 'DataFrame' object has no attribute 'atype'

Hi
Thank you for you work, it's very helpful.

But I'm receiving this error and I'm not sure what to do about it ?
`Retrieving articles URL...

AttributeError Traceback (most recent call last)
in ()
3
4 # Get Article URL List
----> 5 articles_df = get_articles_url(api, country, start_year, end_year)
6 articles_df.tail()

1 frames
/usr/local/lib/python3.6/dist-packages/textminingnyt.py in get_articles_url(api, country, start_year, end_year)
93
94 # Make sure we filter out non-news articles and remove 'atype' column
---> 95 articles_df = articles_df.drop(articles_df[articles_df.atype != 'News'].index)
96 articles_df.drop('atype', axis = 1, inplace = True)
97

/usr/local/lib/python3.6/dist-packages/pandas/core/generic.py in getattr(self, name)
5272 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5273 return self[name]
-> 5274 return object.getattribute(self, name)
5275
5276 def setattr(self, name: str, value) -> None:

AttributeError: 'DataFrame' object has no attribute 'atype'

I hope you can help me
Thanks`

Working with the NYT API and get_articles_url() function.

Some pages requested to the API will return a 'No JSON object could be decoded' and its articles will be left out of analysis. ASAP I will take care of this issue by looping through the troublesome pages until the content is retrieved successfully.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.