Conversation
runnersaw
left a comment
There was a problem hiding this comment.
This review is intended to help you with writing readable and understandable code, not to evaluate or improve the functionality of your code.
Your code is generally very clear as to what it is doing. Variable names are very good, and indicate clearly what they hold. Your code could use some work to split up long chunks of code to make it easier for readers.
| " count_negative = count_negative + 1\n", | ||
| " percent_positive = (count_positive/count_total)*100\n", | ||
| " percent_neutral = (count_neutral/count_total)*100\n", | ||
| " percent_negative = (count_negative/count_total)*100\n", |
There was a problem hiding this comment.
These three lines above can be outside of the for loop. You're overriding them each time and then doing nothing with the result until after the for loop
| " print 'the number of tweets that have a positive sentiment is', count_positive, 'or', percent_positive, '%'\n", | ||
| " print 'the number of tweets that have a neutral sentiment is', count_neutral, 'or', percent_neutral, '%'\n", | ||
| " print 'the number of tweets that have a negative sentiment is', count_negative, 'or', percent_negative, '%'\n", | ||
| " #code for bar graph below using matplotlib python package\n", |
There was a problem hiding this comment.
It's good coding practice to put a line of whitespace between parts of code that do different things. This is helpful visually for a reader. I'd suggest a newline before this comment and also maybe before the for loop above.
There was a problem hiding this comment.
Another alternative is to split this into two functions. One is return_sentiment_counts which returns a three-long list like [34,35,31], and one which is plot_results which takes the result of the previous and plots it. This will help you when reading and debugging code. (You could also create a function sent_analysis, which calls these two functions in the proper order.)
|
This is some final feedback about your first mini-project. Fantastic report. The report covers all aspects and questions, with the right level of depth. It is clear that you were thoughtful when putting together the report. The code runs without modification and implements all required functionality. I encountered an error that was likely due to unicode within one of the searched tweets (which was easily fixed using Documentation is mostly absent. There is one comment that indicates the portion of the function that deals with plotting the data, but no other comments. Variable and function names are well-chosen, and the code is largely organized logically. I would recommend that you split the code for searching Twitter and the code for plotting the results into two separate functions. |
No description provided.