From d31ffb55b8528f042b61b93d625005e35bf1b7a5 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 19 Feb 2020 22:26:03 -0800 Subject: [PATCH 01/14] minor edits to Lab 3.1 --- Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/3.md | 2 ++ Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/5.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/3.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/3.md index 5dbfd358..1aca2117 100644 --- a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/3.md +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/3.md @@ -2,3 +2,5 @@ First, we'll have to complete the function `produce_dataframe()`. Please reference the description in the starter code. Bear in mind we provide what will be passed into the `search_query` parameter for you, and you are not allowed to change any function definition or given code. By the end, you should have a data frame with just the date and sentiment of each tweet found. +When finished, define a function `init_dataframes()` which calls `produce_dataframe()` with the proper parameters. + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/5.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/5.md index cdcbc47b..d5b1ea54 100644 --- a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/5.md +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/5.md @@ -2,7 +2,7 @@ Now that we have our dataframe with the number of positive, neutral, and negative tweets for each candidate, it's time to graph! -We'll be graphing a bar graph representing the total number of tweets per day for +We'll be graphing a bar graph representing the total number of tweets per day for the days of the tweets, and overlay a line graph depicting the amount of tweets with positive/neutral/negative sentiment on each day. Inside of the function `produce_graph(df, keys)`, create a bar graph, with each bar labelled with an appropriate date for the tick. Then on top of that bar graph, create a line graph with three lines for the positive, neutral, and negative sentiment on *each day*. From 42a29914e684f7a01eb2aa2bf4e3da1b6c59aa07 Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 25 Feb 2020 13:57:12 -0800 Subject: [PATCH 02/14] Testing local images --- .../activities/Act3_Binary Heaps/1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Module4.2_Intermediate_Data_Structures/activities/Act3_Binary Heaps/1.md b/Module4.2_Intermediate_Data_Structures/activities/Act3_Binary Heaps/1.md index fc2c2790..084a1cb4 100644 --- a/Module4.2_Intermediate_Data_Structures/activities/Act3_Binary Heaps/1.md +++ b/Module4.2_Intermediate_Data_Structures/activities/Act3_Binary Heaps/1.md @@ -52,7 +52,7 @@ class BinHeap: self.currentSize = 0 ``` - +![MaxHeap deletion](./delmaxheap.png) From c08a5892acb6970d969492b63fc5c8483bb745ce Mon Sep 17 00:00:00 2001 From: Kevin Vuong Date: Tue, 25 Feb 2020 13:59:16 -0800 Subject: [PATCH 03/14] revert test --- .../activities/Act3_Binary Heaps/1.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/Module4.2_Intermediate_Data_Structures/activities/Act3_Binary Heaps/1.md b/Module4.2_Intermediate_Data_Structures/activities/Act3_Binary Heaps/1.md index 084a1cb4..7061aa1e 100644 --- a/Module4.2_Intermediate_Data_Structures/activities/Act3_Binary Heaps/1.md +++ b/Module4.2_Intermediate_Data_Structures/activities/Act3_Binary Heaps/1.md @@ -52,7 +52,5 @@ class BinHeap: self.currentSize = 0 ``` -![MaxHeap deletion](./delmaxheap.png) - From 0ec9b203124b0c298e58b2a727b62898532ffe87 Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 25 Feb 2020 18:28:29 -0800 Subject: [PATCH 04/14] fixing 2.md minesweeper images --- Module3_Labs/Lab3_Minesweeper/Cards/2.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Module3_Labs/Lab3_Minesweeper/Cards/2.md b/Module3_Labs/Lab3_Minesweeper/Cards/2.md index b40fb616..24043d50 100644 --- a/Module3_Labs/Lab3_Minesweeper/Cards/2.md +++ b/Module3_Labs/Lab3_Minesweeper/Cards/2.md @@ -6,15 +6,15 @@ Here are a couple examples of how your output should look: -![Capture](C:\Users\kevin\Documents\Programming\Darlene\Rewritten\Minesweeper\Minesweeper\Capture.PNG) +![Capture](./Capture.PNG) After the first move "55", then the board looks like this: -![Capture(2)](C:\Users\kevin\Documents\Programming\Darlene\Rewritten\Minesweeper\Minesweeper\Capture(2).PNG) +![Capture(2)](./Capture(2).PNG) A little further down the game, I have made some more moves, and I know a flag is at "36". If I want to place a flag there, it would look like this: -![Capture(3)](C:\Users\kevin\Documents\Programming\Darlene\Rewritten\Minesweeper\Minesweeper\Capture(3).PNG) +![Capture(3)](./Capture(3).PNG) Notice the "F" at column 3, row 6. From 3a6fceb06e898b83d75a809aa75e0e1bab4cd38b Mon Sep 17 00:00:00 2001 From: Nathaniel Kong Date: Wed, 26 Feb 2020 00:56:41 -0800 Subject: [PATCH 05/14] Twitter week 2/18 --- .gitignore | 3 + CODE_OF_CONDUCT.md | 76 ------------------- LICENSE | 21 ----- .../Week 3/Airline Sentiment Analysis/1.md | 22 ++++++ .../Week 3/Airline Sentiment Analysis/11.md | 6 ++ .../Week 3/Airline Sentiment Analysis/111.md | 6 ++ .../Week 3/Airline Sentiment Analysis/112.md | 14 ++++ .../Week 3/Airline Sentiment Analysis/113.md | 5 ++ .../Week 3/Airline Sentiment Analysis/12.md | 12 +++ .../Week 3/Airline Sentiment Analysis/121.md | 6 ++ .../Week 3/Airline Sentiment Analysis/122.md | 6 ++ .../Week 3/Airline Sentiment Analysis/123.md | 10 +++ .../Week 3/Airline Sentiment Analysis/2.md | 11 +++ .../Week 3/Airline Sentiment Analysis/21.md | 9 +++ .../Week 3/Airline Sentiment Analysis/211.md | 11 +++ .../Week 3/Airline Sentiment Analysis/212.md | 16 ++++ .../Week 3/Airline Sentiment Analysis/213.md | 8 ++ .../Week 3/Airline Sentiment Analysis/3.md | 24 ++++++ .../Week 3/Airline Sentiment Analysis/31.md | 17 +++++ .../Week 3/Airline Sentiment Analysis/311.md | 25 ++++++ .../Week 3/Airline Sentiment Analysis/312.md | 17 +++++ .../Week 3/Airline Sentiment Analysis/32.md | 14 ++++ .../Week 3/Airline Sentiment Analysis/321.md | 30 ++++++++ .../Week 3/Airline Sentiment Analysis/33.md | 13 ++++ .../Week 3/Airline Sentiment Analysis/4.md | 8 ++ .../Week 3/Airline Sentiment Analysis/5.md | 12 +++ .../Week 3/Airline Sentiment Analysis/51.md | 12 +++ .../Week 3/Airline Sentiment Analysis/52.md | 22 ++++++ .../Week 3/Airline Sentiment Analysis/53.md | 5 ++ .../Week 3/Airline Sentiment Analysis/6.md | 3 + .../Week 3/Democratic Debate Sentiment/1.md | 14 ++++ .../Week 3/Democratic Debate Sentiment/11.md | 6 ++ .../Week 3/Democratic Debate Sentiment/111.md | 6 ++ .../Week 3/Democratic Debate Sentiment/112.md | 8 ++ .../Week 3/Democratic Debate Sentiment/113.md | 7 ++ .../Week 3/Democratic Debate Sentiment/12.md | 12 +++ .../Week 3/Democratic Debate Sentiment/121.md | 14 ++++ .../Week 3/Democratic Debate Sentiment/122.md | 12 +++ .../Week 3/Democratic Debate Sentiment/123.md | 10 +++ .../Week 3/Democratic Debate Sentiment/2.md | 8 ++ .../Week 3/Democratic Debate Sentiment/21.md | 8 ++ .../Week 3/Democratic Debate Sentiment/211.md | 11 +++ .../Week 3/Democratic Debate Sentiment/212.md | 16 ++++ .../Week 3/Democratic Debate Sentiment/213.md | 8 ++ .../Week 3/Democratic Debate Sentiment/3.md | 4 + .../Week 3/Democratic Debate Sentiment/31.md | 12 +++ .../Week 3/Democratic Debate Sentiment/311.md | 20 +++++ .../Week 3/Democratic Debate Sentiment/312.md | 17 +++++ .../Week 3/Democratic Debate Sentiment/32.md | 15 ++++ .../Week 3/Democratic Debate Sentiment/321.md | 30 ++++++++ .../Week 3/Democratic Debate Sentiment/33.md | 3 + .../Week 3/Democratic Debate Sentiment/331.md | 14 ++++ .../Week 3/Democratic Debate Sentiment/4.md | 17 +++++ .../Week 3/Democratic Debate Sentiment/41.md | 12 +++ .../Week 3/Democratic Debate Sentiment/42.md | 22 ++++++ .../Week 3/Democratic Debate Sentiment/43.md | 5 ++ .../Week 3/Democratic Debate Sentiment/5.md | 3 + README.md | 17 ----- 58 files changed, 661 insertions(+), 114 deletions(-) delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 LICENSE create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/1.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/11.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/111.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/112.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/113.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/12.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/121.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/122.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/123.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/2.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/21.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/211.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/212.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/213.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/3.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/31.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/311.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/312.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/32.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/321.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/33.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/4.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/5.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/51.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/52.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/53.md create mode 100644 Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/6.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/1.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/11.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/111.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/112.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/113.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/12.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/121.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/122.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/123.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/2.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/211.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/213.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/3.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/31.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/311.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/312.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/32.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/321.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/33.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/331.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/4.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/41.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/42.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/43.md create mode 100644 Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/5.md delete mode 100644 README.md diff --git a/.gitignore b/.gitignore index 0fa494df..9b2aa331 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +CODE_OF_CONDUCT.md +LICENSE +README.md Module4_Labs/.DS_Store Module4_Labs/Lab2_Doubly_Linked_List/.DS_Store diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index d3c78b8e..00000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,76 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal -appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at info@bitproject.org. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 753d7e05..00000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Bit Project - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/1.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/1.md new file mode 100644 index 00000000..6b894357 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/1.md @@ -0,0 +1,22 @@ + + +For this lab, we will be conducting sentiment analysis on specific US airlines. **Sentiment Analysis** is the analysis of language to identify emotions (positive, negative, etc). + +To perform sentiment analysis we'll be gathering tweets referencing airlines using Twitter's API as well as the `tweepy` and `TextBlob` packages to determine whether generated tweets have a positive, neutral or negative attitude towards the airline in question. Then we'll graph that information, both in the form of a bar and line graph. + +Twitter presence is an important point of emphasis for companies. Twitter users can quickly form a positive or negative opinion of company, depending on what users are tweeting pertaining to companies. Companies perform sentiment analysis frequently to gauge what Twitter's opinion of their company is, and what steps they can take to ensure a positive Twitter presence for their company. We'll conduct an elementary sentiment analysis that companies may conduct for this lab, this is an example of what you should be making by the end: + +![](https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/AirlineSentimentExample.png) + +To get started, you'll need to sign up for a Twitter API developer account. + + + +After you've signed up for the developer account you need to make a new Twitter app and get four credentials for future use: + +* consumer key +* consumer token +* access token +* access secret token + +Paste those credentials into the appropriate area in your starter code. \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/11.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/11.md new file mode 100644 index 00000000..ce744ff4 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/11.md @@ -0,0 +1,6 @@ + + +The following is the signup page for getting a Twitter developer account. Try to navigate to this page by yourself, and follow the steps for an *academic* account. + +![img](https://lh4.googleusercontent.com/bOVrW7NkR9zdzVGR5Wpn4blHLWwsbRapfxYJdsFB2MXaEGDfD6GQ7REp8h42A3fSQmHDLtpAhsxEuSymYElifWq_dn4742hYwzfhO2nmZce6u5CtLhh8mJmBLSQ4KydLGG9NMWNp9F4) + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/111.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/111.md new file mode 100644 index 00000000..0d68aa37 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/111.md @@ -0,0 +1,6 @@ + + +If you couldn't find it, the Twitter Developer application is found [here](https://developer.twitter.com/en/apps). Using the Twitter API requires an account, so you'll need to follow the steps, starting with clicking “Apply”. + + + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/112.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/112.md new file mode 100644 index 00000000..58de33b3 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/112.md @@ -0,0 +1,14 @@ + + +The Twitter developer application process starts at this page, please complete the form. Once you click 'student', proceed to the rest of the Application. + + + +When you're prompted to explain your use, you can explain that you'll be using Twitter to perform sentiment analysis for learning purposes. + + + +You will also be analyzing Twitter data, you can say this is also part of the exercise. + +![img](https://lh4.googleusercontent.com/bOVrW7NkR9zdzVGR5Wpn4blHLWwsbRapfxYJdsFB2MXaEGDfD6GQ7REp8h42A3fSQmHDLtpAhsxEuSymYElifWq_dn4742hYwzfhO2nmZce6u5CtLhh8mJmBLSQ4KydLGG9NMWNp9F4) + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/113.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/113.md new file mode 100644 index 00000000..78566499 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/113.md @@ -0,0 +1,5 @@ + + +After finishing your application, confirm your email and your account should be processed and reviewed swiftly. + +![img](https://lh4.googleusercontent.com/8BKvmctSfLQEKERSZIc9_3jKl7lnpkRJO3736TBuIkfwBzZhkZMmPL8hUnNjrCf27SqX1iZaHOv1RBrNfB2V1990cl9z35ojA-RjoDnN0vgn5XWuDhwMjpbbhHLj5J1qcuq4M2KSC4g) \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/12.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/12.md new file mode 100644 index 00000000..11b31eef --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/12.md @@ -0,0 +1,12 @@ + + +When you have finished configuring your account, head back to Twitter Developer [here](https://developer.twitter.com/en/apps), your app menu should look like this: + +![img](https://lh6.googleusercontent.com/c2Eey4CUXd9gi3LFLPvbpKpDr1_qNTyZGHMKngCAjZ_prK1rITeI7AnLtWPRr0v_gRIGIxbT6MQUl7GAQ8wq6Hx1_JuFZFOhcUaPPhbf8RPTSprIvtluuqKWf3LULkCqRP-1FaPrkAU)Click on “Create an app”. Fill out app details; for the website URL field, you can input any website, we used https://bitproject.org. Leave the OAuth Callback URL, TOS and Privacy Policy fields blank. + +After creating your app, head to its “Keys and tokens” section, where you will find an API key and API secret key. Copy these keys for later use. (these keys in the picture have been erased) + +![img](https://lh4.googleusercontent.com/fLq7LZu_w2JKb2HCFHptAT1Ln4Z00JNMNq47knue29sH5HzWCSWbx_o6xpSeT0qOytCI7CLF8HqTdxlRQ_wb4JC9x_TnvSYgr8Ssjd3BKZBThHii-CkInXZ5UHO8mFVZU2L2e6DwpoE) + +There is also an area to generate an access token and access secret token, please generate them and keep track of those as well. + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/121.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/121.md new file mode 100644 index 00000000..07a09b03 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/121.md @@ -0,0 +1,6 @@ + + +Head back to Twitter Developer [here](https://developer.twitter.com/en/apps), your app menu should look like this: + +![img](https://lh6.googleusercontent.com/c2Eey4CUXd9gi3LFLPvbpKpDr1_qNTyZGHMKngCAjZ_prK1rITeI7AnLtWPRr0v_gRIGIxbT6MQUl7GAQ8wq6Hx1_JuFZFOhcUaPPhbf8RPTSprIvtluuqKWf3LULkCqRP-1FaPrkAU)Click on “Create an app”. + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/122.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/122.md new file mode 100644 index 00000000..3f94fc25 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/122.md @@ -0,0 +1,6 @@ + + +In the creation of your app, fill out all the required information for your app details. For the website URL field, you can input any website, we used https://bitproject.org. Leave the OAuth Callback URL, TOS and Privacy Policy fields blank. + +![img](https://lh6.googleusercontent.com/wCWo0frQNm2aPD3Fv30kMC90DQDk880eGb1KTGrL5I7dOjis95GoVBI2zJJ3tacIz-0ux9HFpgAYeB4Ym_LC2OAPabCMRzGeiRtnVRUbKAqn_PdGyMLunDhZCo_h-4XIysnYivjUwnI) + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/123.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/123.md new file mode 100644 index 00000000..1fef04ca --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/123.md @@ -0,0 +1,10 @@ + + +After creating your app, head to its “Keys and tokens” section, where you will find an API key and API secret key. Copy these keys for later use. (these keys in the picture have been erased) + +![img](https://lh4.googleusercontent.com/fLq7LZu_w2JKb2HCFHptAT1Ln4Z00JNMNq47knue29sH5HzWCSWbx_o6xpSeT0qOytCI7CLF8HqTdxlRQ_wb4JC9x_TnvSYgr8Ssjd3BKZBThHii-CkInXZ5UHO8mFVZU2L2e6DwpoE) + + + +Below the consumer API keys, there is also an area to generate an access token and access secret token, please generate them and keep track of those as well. + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/2.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/2.md new file mode 100644 index 00000000..dec38154 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/2.md @@ -0,0 +1,11 @@ + + +The goal of this card is to set up authentication so your application can use Tweet information. You should: + +* Paste your keys and tokens in the starter code. +* Configure OAuth authentication with your consumer key and secret +* Set your access tokens and create a API object in `tweepy` to fetch tweets. + +Bear in mind we will be using the `us_search` dictionary for the rest of this lab. + +![image](https://images.pexels.com/photos/58639/pexels-photo-58639.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940) \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/21.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/21.md new file mode 100644 index 00000000..a29a2b09 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/21.md @@ -0,0 +1,9 @@ + + +Paste your keys and tokens in the allocated space. You'll want to authenticate in three steps: + +1. Configure OAuth authentication with your consumer key and secret with the `OAuthHandler(consumer_key, consumer_secret)` call. This should create an `auth` object +2. Set your access tokens with `auth.set_access_token()` +3. Create a API object in `tweepy` to fetch tweets: `tweepy.API(auth, wait_on_rate_limit=True)` + +![image](https://images.pexels.com/photos/46148/aircraft-jet-landing-cloud-46148.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940) \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/211.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/211.md new file mode 100644 index 00000000..e2aa9472 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/211.md @@ -0,0 +1,11 @@ +j + +Remember all those credentials you generated? Paste them appropriately in the starter code. + +```python +consumer_key = 'xxx' +consumer_secret = 'xxx' +access_token = 'xxx' +access_token_secret = 'xxx' +``` + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/212.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/212.md new file mode 100644 index 00000000..0d30563d --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/212.md @@ -0,0 +1,16 @@ + + +We are now going to authenticate using our app credentials. Please look at the next two lines of code: + +```python +auth = OAuthHandler(consumer_key, consumer_secret) +``` + +This line generates an authentication object using our consumer key and secret. + +```python +auth.set_access_token(access_token, access_token_secret) +``` + +This line enables access to our authentication object with our access token and access secret token. + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/213.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/213.md new file mode 100644 index 00000000..e7466b3c --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/213.md @@ -0,0 +1,8 @@ + + +The `tweepy` package allows us to very easily use Twitter's API within a Python environment. The line below will give us an API object that will allow us to fetch tweets. + +```python +api = tw.API(auth, wait_on_rate_limit=True) +``` + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/3.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/3.md new file mode 100644 index 00000000..8168a52d --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/3.md @@ -0,0 +1,24 @@ + + +Now that our application is set up, we're going to produce a dataframe that stores two items: the data, and the sentiment of each tweet found. + + + +Complete the function `produce_dataframe(search_dict, num_tweets)`, with the following descriptions of the parameters: + +* `search_dict` - a dictionary that has a {key, value} pair in the items category. The `key` is the date you will be searching for, and the `value` is the name of the airline you will search for. +* `num_tweets` - the number of tweets in the search dictionary + + + +The function `produce_dataframe(search_dict, num_tweets)` should complete the following checklist: + +* Return a dataframe using the `pandas` library, the column names should be 'date', and 'sentiment'. Set rownames to 'positive', 'neutral', and 'negative.' +* Fill the returning dataframe with + + + +You are not allowed to change any function definition or code that was given to you. The end result should look like this: + +![image]() + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/31.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/31.md new file mode 100644 index 00000000..857614b8 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/31.md @@ -0,0 +1,17 @@ + + + + +In order to add items to the dataframe, we first need to create dataframe. We can use the `pandas` library to create a dataframe. + +The function we want to use is `pandas.Dataframe(arguments)`. Use the argument: + +* `index` to set the rownames to 'positive', 'neutral', and 'negative.' +* `columns` to set the columnnames to `date` and `sentiment` + + + +If you run your code before inserting any data, your graph should look like this: + +![image]() + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/311.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/311.md new file mode 100644 index 00000000..5932b831 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/311.md @@ -0,0 +1,25 @@ + + + + +We can create a `pandas` dataframe with the function `pd.DataFrame()`. If we want a dataframe with the following structure (it currently has : + +| | Airline_0 | Airline_1 | ... | +| -------- | --------- | --------- | ---- | +| positive | ... | ... | ... | +| neutral | ... | ... | ... | +| negative | ... | ... | ... | + +We need the arguments: + +* `data` - this argument is defaulted to None, we define it to an explicit `[]` +* `Index` - We'll set this to a list of []'positive', 'neutral', 'negative'] + +Our final code looks like: + +```python +df = pd.DataFrame([], index=['positive', 'neutral', 'negative']) +``` + +Now we need to get the tweets from the cursor object + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/312.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/312.md new file mode 100644 index 00000000..f32b7d59 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/312.md @@ -0,0 +1,17 @@ + + +The `Cursor` in `tweepy` will allow us to find `num_tweets` tweets given a search query `val`. + +```python +# Collect tweets +tweets = tw.Cursor(api.search, q=val, lang="en", since=date_since).items(num_tweets) +``` + +Because we are given a dictionary with search queries, we want to iterate through this dictionary and call the above line for each search query (each query corresponds to one airline): + +```python +for key, val in search_dict.items(): + # Collect tweets + tweets = tw.Cursor(api.search, q=val, lang="en", since=date_since).items(num_tweets) +``` + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/32.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/32.md new file mode 100644 index 00000000..ed653a2d --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/32.md @@ -0,0 +1,14 @@ + + + + +Now that we've created our Dataframe, we need to fill our dataframe. Recall the parameter `search_dict` is a dictionary that has a {key, value} pair in the items category. The `key` is the date you will be searching for, and the `value` is the name of the airline you will search for. + + + +After producing the dataframe you should iterate through the `search_dict` and call the `tweepy.Cursor()` object to get the tweets with the search query. + + + +![image]() + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/321.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/321.md new file mode 100644 index 00000000..6a27d795 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/321.md @@ -0,0 +1,30 @@ + + + + +For each tweet object in the cursor, we can use the `.text` attribute to get the text of the tweet itself. Then for each text, we make a `TextBlob` object out of that text. + +From there, simply check the values of the `.sentiment.polarity` attribute. Positive polarity indicates positive sentiment, zero polarity indicates neutral sentiment and neutral polarity indicates negative sentiment. + +We keep track of positive, neutral and negative tweets with counter variables. At the end, we add the acquired sentiment data to the dataframe. + +Return `df` at the end. + +```python +for key, val in search_dict.items(): + # ... + + positive = 0 + neutral = 0 + negative = 0 + for t in tweets: + analysis = TextBlob(t.text) + if analysis.sentiment.polarity > 0: + positive += 1 + elif analysis.sentiment.polarity == 0: + neutral += 1 + else: + negative += 1 + df[key] = [positive, neutral, negative] +return df +``` \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/33.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/33.md new file mode 100644 index 00000000..69b0311c --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/33.md @@ -0,0 +1,13 @@ + + +Now that we've got the tweets, we need to iterate through the tweets to find the sentiments. + + + +We also want to keep track of how many of each sentiments you have. Make sure to initialize the number of sentiments of each 'positive', 'neutral' or 'negative' first. + + + +You need to use the `TextBlob` module to get the `sentiment.polarity` attribute. For each item in the Tweets we have, set the item in the dataframe date to the sentiment. + +![image]() \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/4.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/4.md new file mode 100644 index 00000000..b634e8b6 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/4.md @@ -0,0 +1,8 @@ +# Set-up Dataframes for Graph + +Now that we have our raw dataframe of dates and sentiments, we need to calculate the total tweets and the percentage of positive/neutral/negative tweets per day. + +Set up *one* dataframe that contains all of that data. This is what your dataframe should look like: + +![](https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/Airline_DF.PNG) + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/5.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/5.md new file mode 100644 index 00000000..cdcbc47b --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/5.md @@ -0,0 +1,12 @@ +# Graphing + +Now that we have our dataframe with the number of positive, neutral, and negative tweets for each candidate, it's time to graph! + +We'll be graphing a bar graph representing the total number of tweets per day for + +Inside of the function `produce_graph(df, keys)`, create a bar graph, with each bar labelled with an appropriate date for the tick. Then on top of that bar graph, create a line graph with three lines for the positive, neutral, and negative sentiment on *each day*. + +Data presentation is everything - without putting your due diligence into your presentation, less people will read your analytics! So make sure your graph is properly titled, with a legend, x-axes, y-axes, and x and y labels. Don't forget to have 2 y-axes! (one for your bar graph and one for your line graph). As a reminder this is what your graph should look like: + +![](https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/AirlineSentimentExample.png) + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/51.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/51.md new file mode 100644 index 00000000..49a59138 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/51.md @@ -0,0 +1,12 @@ +# Setting Up Bars + +Remember that even though this is a stacked bar graph, you are still essentially graphing numbers on a bar graph, with the caveat that the bars are on top of each other, and so the location of the bars needs to be controlled. + +To make your bars on your graph, there are two steps you need to take: + +* Locate the positive, neutral and negative lists in your data frame. That is the data you will be graphing. +* Use `plt.bar` to graph bar graphs. + * Start off with just graphing the positive bars and making sure those work. + * Then graph the neutral bars, setting the **bottom** to be the positive bars. + * Do the same for negative bars. + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/52.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/52.md new file mode 100644 index 00000000..65ab6ddc --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/52.md @@ -0,0 +1,22 @@ +# Making Graph Pretty + +Now that your bars are set up, your graph most likely looks unorganized. To organize our graph better, we can set margins to the x ticks to space them out. Because the specifics of how to space out x tick labels can get quite complicated and out of the scope of this bootcamp, I'll provide a chunk of code for you here: + +```python +# space out x ticks and give margins +plt.gca().margins(x=0) +plt.gcf().canvas.draw() +tl = plt.gca().get_xticklabels() +maxsize = max([t.get_window_extent().width for t in tl]) +m = 0.1 # inch margin +s = maxsize/plt.gcf().dpi*7+2*m +margin = m/plt.gcf().get_size_inches()[0] + +plt.gcf().subplots_adjust(left=margin, right=1.-margin) +plt.gcf().set_size_inches(s, plt.gcf().get_size_inches()[1]) +``` + +This code should space out your x ticks and set margins. + +Don't forget a title (`plt.title`) and a legend (`plt.legend`)! + diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/53.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/53.md new file mode 100644 index 00000000..224384de --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/53.md @@ -0,0 +1,5 @@ +# Text Labels + +To add text labels, we'll have to iterate through all the bars and append an appropriate label to each one. So firstly, set up a list called `labels`, that has all the positive, neutral and negative data *in one list*. + +We can use `ax.patches` to find a list of all the bars currently in the graph. We can then `zip` the labels and patches together, iterate through that, and for each patch use `ax.text` to attribute a label to each bar. Make sure you have an appropriate location when using `ax.text`! \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/6.md b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/6.md new file mode 100644 index 00000000..45f890d6 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Airline Sentiment Analysis/6.md @@ -0,0 +1,3 @@ +# `main()` + +It's time to put all of our functions together into a program! Call `produce_dataframe()` and `produce_graph` inside of your main() function with the proper parameters, and run your main() to see your graphs made! \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/1.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/1.md new file mode 100644 index 00000000..bd409861 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/1.md @@ -0,0 +1,14 @@ + + +With the wealth of information at our disposal, American politics have increasingly become a game of misinformation and narrative twisting. To win elections, often times it doesn't matter what political candidates actually do or say, but how candidates can control the narrative surrounding their campaigns, and what the American people think of their candidates. + +Twitter reactions are a valuable source of political opinions from regular Americans, because anyone can tweet their honest feelings about political candidates. Using sentiment analysis on Americans' tweets can give us genuine insight on the sentiment behind every candidate in the race, outside of media spin or campaign biases. For this lab, we'll dive into the tweets during and after the 7th Democratic Debate to gauge how average Americans perceive political candidates, and graph our results in a stacked bar graph! Here is what the result should look like: + +![](https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/6thDemDebateGraph.png) + +To do this, we'll be gathering tweets referencing political candidates using Twitter's API as well as the `tweepy` and `TextBlob`packages to determine whether generated tweets have a positive, neutral or negative attitude towards the airlines. + +Proceed to Twitter Developer [here](https://developer.twitter.com/en/apps), and you'll need to make a new Twitter app and get four credentials for future use: consumer key, consumer token, access token and access secret token. + +Paste those credentials into the appropriate area in your starter code. + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/11.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/11.md new file mode 100644 index 00000000..20e2f2c8 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/11.md @@ -0,0 +1,6 @@ + + +The Twitter developer application process starts here, please complete the form. + +![img](https://lh4.googleusercontent.com/bOVrW7NkR9zdzVGR5Wpn4blHLWwsbRapfxYJdsFB2MXaEGDfD6GQ7REp8h42A3fSQmHDLtpAhsxEuSymYElifWq_dn4742hYwzfhO2nmZce6u5CtLhh8mJmBLSQ4KydLGG9NMWNp9F4) + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/111.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/111.md new file mode 100644 index 00000000..6e78cbed --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/111.md @@ -0,0 +1,6 @@ + + +Proceed to Twitter Developer [here](https://developer.twitter.com/en/apps). Implementing sign-in with Twitter requires a Twitter developer account, so click “Apply”. + + + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/112.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/112.md new file mode 100644 index 00000000..7c1b766b --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/112.md @@ -0,0 +1,8 @@ + + +The Twitter developer application process starts here, please complete the form. + +As you are most likely a student, click on the student option to begin. If another option is more relevant, click on that instead. + +![img](https://lh4.googleusercontent.com/bOVrW7NkR9zdzVGR5Wpn4blHLWwsbRapfxYJdsFB2MXaEGDfD6GQ7REp8h42A3fSQmHDLtpAhsxEuSymYElifWq_dn4742hYwzfhO2nmZce6u5CtLhh8mJmBLSQ4KydLGG9NMWNp9F4) + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/113.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/113.md new file mode 100644 index 00000000..72fa16f4 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/113.md @@ -0,0 +1,7 @@ + + +After finishing your application, confirm your email and your account should be processed and reviewed swiftly. + +![img](https://lh4.googleusercontent.com/8BKvmctSfLQEKERSZIc9_3jKl7lnpkRJO3736TBuIkfwBzZhkZMmPL8hUnNjrCf27SqX1iZaHOv1RBrNfB2V1990cl9z35ojA-RjoDnN0vgn5XWuDhwMjpbbhHLj5J1qcuq4M2KSC4g) + +After you have been approved, you will then be able to access the neccessary API keys. Be patient! This process can lasrt up to 2 bussiness weeks. \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/12.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/12.md new file mode 100644 index 00000000..03be66ab --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/12.md @@ -0,0 +1,12 @@ + + +When you have finished configuring your account, head back to Twitter Developer [here](https://developer.twitter.com/en/apps), your app menu should look like this: + +![qf76jiT](https://i.imgur.com/qf76jiT.png) + +Click on “Create an app” and fill out app details. + +After creating your app, head to its “Keys and tokens” section, where you will find an API key and API secret key. Copy these keys for later use (these keys in the picture have been erased). The keys will be used to access Twitter's sentiment anlysis API and will be inserted into the starter code. + +There is also an area to generate an access token and access secret token, please generate them and keep track of those as well. They will be used in the starter code. + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/121.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/121.md new file mode 100644 index 00000000..8001cb9d --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/121.md @@ -0,0 +1,14 @@ + + +Head back to Twitter Developer [here](https://developer.twitter.com/en/apps), your app menu should look like this: + +![qf76jiT](https://i.imgur.com/qf76jiT.png)Click on “Create an app”. Fill out app details; for the website URL field, you can input any website, we used https://bitproject.org. Leave the OAuth Callback URL, TOS and Privacy Policy fields blank. + +After creating your app, head to its “Keys and tokens” section, where you will find an API key and API secret key. Copy these keys for later use. (these keys in the picture have been erased) + +![img](https://lh4.googleusercontent.com/fLq7LZu_w2JKb2HCFHptAT1Ln4Z00JNMNq47knue29sH5HzWCSWbx_o6xpSeT0qOytCI7CLF8HqTdxlRQ_wb4JC9x_TnvSYgr8Ssjd3BKZBThHii-CkInXZ5UHO8mFVZU2L2e6DwpoE) + +There is also an area to generate an access token and access secret token, please generate them and keep track of those as well. + + + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/122.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/122.md new file mode 100644 index 00000000..42c3898b --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/122.md @@ -0,0 +1,12 @@ + + +In the creation of your app, fill out all the required information for your app details. For the website URL field, you can input any website, we used https://bitproject.org. Leave the OAuth Callback URL, TOS and Privacy Policy fields blank. + + OAuth Callback URLs are used for providing directions on where a user should go after signing in with their Twitter credentials. They can even be used to redirect a user to a spcific page, which won't be neccessary for our lab. + +TOS stands for 'terms of service' which again, we don't need to specify here. + +Privacy Policy is similar to TOS, but would explain to users what the data collected from them would be used for. Since there will be no users other than yourself, it is not relevant. + +![img](https://lh6.googleusercontent.com/wCWo0frQNm2aPD3Fv30kMC90DQDk880eGb1KTGrL5I7dOjis95GoVBI2zJJ3tacIz-0ux9HFpgAYeB4Ym_LC2OAPabCMRzGeiRtnVRUbKAqn_PdGyMLunDhZCo_h-4XIysnYivjUwnI) + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/123.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/123.md new file mode 100644 index 00000000..77467a79 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/123.md @@ -0,0 +1,10 @@ + + +After creating your app, head to its “Keys and tokens” section, where you will find an API key and API secret key. Copy these keys for later use. (these keys in the picture have been erased) + +![img](https://lh4.googleusercontent.com/fLq7LZu_w2JKb2HCFHptAT1Ln4Z00JNMNq47knue29sH5HzWCSWbx_o6xpSeT0qOytCI7CLF8HqTdxlRQ_wb4JC9x_TnvSYgr8Ssjd3BKZBThHii-CkInXZ5UHO8mFVZU2L2e6DwpoE) + + + +Below the consumer API keys, there is also an area to generate an access token and access secret token, please generate them and keep track of those as well. Remember, these keys will be used to access Twitter's sentiment anlysis API and will be inserted into the starter code. + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/2.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/2.md new file mode 100644 index 00000000..d9df4b71 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/2.md @@ -0,0 +1,8 @@ + + + + +Paste your keys and tokens in the allocated space. Then configure OAuth authentication with your consumer key and secret, set your access tokens and create a API object in `tweepy` to fetch tweets. + +Bear in mind we will be using the `dem_search` dictionary for the rest of this lab. + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md new file mode 100644 index 00000000..77cae357 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md @@ -0,0 +1,8 @@ + + +Paste your keys and tokens in the allocated space. You'll want to authenticate in three steps: + +1. Configure OAuth authentication with your consumer key and secret with the `OAuthHandler(consumer_key, consumer_secret)` call. This should create an `auth` object +2. Set your access tokens with `auth.set_access_token()`. +3. Create a API object in `tweepy` to fetch tweets: `tweepy.API(auth, wait_on_rate_limit=True)` + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/211.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/211.md new file mode 100644 index 00000000..e2315f0b --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/211.md @@ -0,0 +1,11 @@ + + +Remember all those credentials you generated? Paste them appropriately in the starter code. + +```python +consumer_key = 'xxx' +consumer_secret = 'xxx' +access_token = 'xxx' +access_token_secret = 'xxx' +``` + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md new file mode 100644 index 00000000..0d30563d --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md @@ -0,0 +1,16 @@ + + +We are now going to authenticate using our app credentials. Please look at the next two lines of code: + +```python +auth = OAuthHandler(consumer_key, consumer_secret) +``` + +This line generates an authentication object using our consumer key and secret. + +```python +auth.set_access_token(access_token, access_token_secret) +``` + +This line enables access to our authentication object with our access token and access secret token. + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/213.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/213.md new file mode 100644 index 00000000..e7466b3c --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/213.md @@ -0,0 +1,8 @@ + + +The `tweepy` package allows us to very easily use Twitter's API within a Python environment. The line below will give us an API object that will allow us to fetch tweets. + +```python +api = tw.API(auth, wait_on_rate_limit=True) +``` + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/3.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/3.md new file mode 100644 index 00000000..5e059159 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/3.md @@ -0,0 +1,4 @@ +# Producing Dataframes + +First, we'll have to complete the function `produce_dataframe()`. Please reference the description in the starter code. Bear in mind we provide what will be passed into the `search_dict` parameter for you, and you are not allowed to change any function definition or given code. + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/31.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/31.md new file mode 100644 index 00000000..27371b7d --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/31.md @@ -0,0 +1,12 @@ + + + + +Our end result is going to be a dataframe indexed by sentiment categories `['positive', 'neutral', 'negative']` and our columns being various airlines of a category. From this dataframe, one should be able to easily look up the number of positive/neutral/negative tweets regarding an airline. + +Firstly, make a empty dataframe `df` indexed by the array `['positive', 'neutral', 'negative']`. + +A `search_dict` simply is a dictionary with airline names mapped to appropriate search queries on Twitter. We can use `tweepy` to search for tweets including those search queries. + +For each search query, use the `Cursor` object from `tweepy` to generate n number of tweets including each query. (n corresponds to the parameter `num_tweets` in this case.) + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/311.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/311.md new file mode 100644 index 00000000..4e41893f --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/311.md @@ -0,0 +1,20 @@ + + + + +We want a dataframe with the following structure: + + + +| | Airline_0 | Airline_1 | ... | +| -------- | --------------- | --------------- | ---- | +| positive | 321 | 23 | ... | +| neutral | 76 | 32 | ... | +| negative | \# example data | \# example data | ... | + +Our dataframe `df` will do the trick: + +``` +df = pd.DataFrame([], index=['positive', 'neutral', 'negative']) +``` + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/312.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/312.md new file mode 100644 index 00000000..f32b7d59 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/312.md @@ -0,0 +1,17 @@ + + +The `Cursor` in `tweepy` will allow us to find `num_tweets` tweets given a search query `val`. + +```python +# Collect tweets +tweets = tw.Cursor(api.search, q=val, lang="en", since=date_since).items(num_tweets) +``` + +Because we are given a dictionary with search queries, we want to iterate through this dictionary and call the above line for each search query (each query corresponds to one airline): + +```python +for key, val in search_dict.items(): + # Collect tweets + tweets = tw.Cursor(api.search, q=val, lang="en", since=date_since).items(num_tweets) +``` + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/32.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/32.md new file mode 100644 index 00000000..b96fa681 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/32.md @@ -0,0 +1,15 @@ + + + + +In our `Cursor` object is a list of tweets with our search query. + +Iterate through this cursor object and find whether its sentiment is positive, neutral or negative. + +* You'll have to use `TextBlob` as well as the `sentiment.polarity` attribute. + +Keep track of a count of positive, neutral and negative tweets. + +When done iterating through the tweets, index the dataframe so that the sentiment data shows up in your dataframe. + +The function should return `df`. \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/321.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/321.md new file mode 100644 index 00000000..6a27d795 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/321.md @@ -0,0 +1,30 @@ + + + + +For each tweet object in the cursor, we can use the `.text` attribute to get the text of the tweet itself. Then for each text, we make a `TextBlob` object out of that text. + +From there, simply check the values of the `.sentiment.polarity` attribute. Positive polarity indicates positive sentiment, zero polarity indicates neutral sentiment and neutral polarity indicates negative sentiment. + +We keep track of positive, neutral and negative tweets with counter variables. At the end, we add the acquired sentiment data to the dataframe. + +Return `df` at the end. + +```python +for key, val in search_dict.items(): + # ... + + positive = 0 + neutral = 0 + negative = 0 + for t in tweets: + analysis = TextBlob(t.text) + if analysis.sentiment.polarity > 0: + positive += 1 + elif analysis.sentiment.polarity == 0: + neutral += 1 + else: + negative += 1 + df[key] = [positive, neutral, negative] +return df +``` \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/33.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/33.md new file mode 100644 index 00000000..b5fc3605 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/33.md @@ -0,0 +1,3 @@ + + +Now let's fill out `init_dataframes()`. Call your method `produce_dataframe` on the defined dictionaries `low_cost_search` and `luxury_search` to produce two dataframes which consist of sentiment data on low-cost airlines and luxury airlines. Print *the entirety* of these dataframes to the Python console and return *both* of them. \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/331.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/331.md new file mode 100644 index 00000000..9d87b411 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/331.md @@ -0,0 +1,14 @@ + + +To do this, call `produce_dataframe()` twice on `low_cost_search` and `luxury_search`, each with the 100 tweets as a parameter. + +Then we print the *entirety* of the dataframe using `.to_string()` and return the resulting dataframes. + +```python +def init_dataframes(): + low_cost_df = produce_dataframe(low_cost_search, 100) + luxury_cost_df = produce_dataframe(luxury_search, 100) + print(low_cost_df.to_string()) + print(luxury_cost_df.to_string()) + return low_cost_df, luxury_cost_df +``` \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/4.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/4.md new file mode 100644 index 00000000..9cb3384a --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/4.md @@ -0,0 +1,17 @@ +# Graphing + +Now that we have our dataframe with the number of positive, neutral, and negative tweets for each candidate, it's time to graph! + +Inside of the function `produce_graph(df, keys)`, create a stacked bar graph, with each bar labelled with the number of the positive/neutral/negative tweets. Data presentation is everything - without putting your due diligence into your presentation, less people will read your analytics! So make sure your graph is properly titled, with a legend, x-axes, y-axes, and x and y labels. + +Here are some formatting rules (and hints!) that were used in the graph below: + +* Width of bars is 0.40 +* The legend is placed outside the graph using `bbox_to_anchor` +* 0.1 inch margin between x-axis labels +* Think about what `matplotlib` function you would use to set up a bar graph. How would you set up bars so that the bottom of one bar is set at the same location as the top of another? +* You can set up text labels by initializing a figure `fig` with `plt.figure`, then initializing a subplot `ax` with `fig.add_subplot` and adding text labels at a location `(x, y)` with `ax.text(x, y, ...)` + +Remember that this is the result you are aiming for: + +![](https://projectbit.s3-us-west-1.amazonaws.com/darlene/labs/6thDemDebateGraph.png) \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/41.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/41.md new file mode 100644 index 00000000..49a59138 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/41.md @@ -0,0 +1,12 @@ +# Setting Up Bars + +Remember that even though this is a stacked bar graph, you are still essentially graphing numbers on a bar graph, with the caveat that the bars are on top of each other, and so the location of the bars needs to be controlled. + +To make your bars on your graph, there are two steps you need to take: + +* Locate the positive, neutral and negative lists in your data frame. That is the data you will be graphing. +* Use `plt.bar` to graph bar graphs. + * Start off with just graphing the positive bars and making sure those work. + * Then graph the neutral bars, setting the **bottom** to be the positive bars. + * Do the same for negative bars. + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/42.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/42.md new file mode 100644 index 00000000..65ab6ddc --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/42.md @@ -0,0 +1,22 @@ +# Making Graph Pretty + +Now that your bars are set up, your graph most likely looks unorganized. To organize our graph better, we can set margins to the x ticks to space them out. Because the specifics of how to space out x tick labels can get quite complicated and out of the scope of this bootcamp, I'll provide a chunk of code for you here: + +```python +# space out x ticks and give margins +plt.gca().margins(x=0) +plt.gcf().canvas.draw() +tl = plt.gca().get_xticklabels() +maxsize = max([t.get_window_extent().width for t in tl]) +m = 0.1 # inch margin +s = maxsize/plt.gcf().dpi*7+2*m +margin = m/plt.gcf().get_size_inches()[0] + +plt.gcf().subplots_adjust(left=margin, right=1.-margin) +plt.gcf().set_size_inches(s, plt.gcf().get_size_inches()[1]) +``` + +This code should space out your x ticks and set margins. + +Don't forget a title (`plt.title`) and a legend (`plt.legend`)! + diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/43.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/43.md new file mode 100644 index 00000000..224384de --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/43.md @@ -0,0 +1,5 @@ +# Text Labels + +To add text labels, we'll have to iterate through all the bars and append an appropriate label to each one. So firstly, set up a list called `labels`, that has all the positive, neutral and negative data *in one list*. + +We can use `ax.patches` to find a list of all the bars currently in the graph. We can then `zip` the labels and patches together, iterate through that, and for each patch use `ax.text` to attribute a label to each bar. Make sure you have an appropriate location when using `ax.text`! \ No newline at end of file diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/5.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/5.md new file mode 100644 index 00000000..45f890d6 --- /dev/null +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/5.md @@ -0,0 +1,3 @@ +# `main()` + +It's time to put all of our functions together into a program! Call `produce_dataframe()` and `produce_graph` inside of your main() function with the proper parameters, and run your main() to see your graphs made! \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 3b61c21d..00000000 --- a/README.md +++ /dev/null @@ -1,17 +0,0 @@ -![IMAGE ALT TEXT HERE](https://i.ibb.co/470bVsn/Bit-Project-2.png) -## Bit Project's Software Engineering Curriculum -Bit Project is a student club based in Davis, CA that creates resources for anyone to learn how to code. We value - -## About Us -We make software engineering and computer science education accessible to students from nontraditional learning environments. Using our curriculum, we take students with minimal experience in computer science to a full-fledged software developer with a diverse coding portfolio using our curriculum. We collaborate with leading companies and developers to create interactive, fun technical content that use industry standard technologies and developer tools. - -## 🐛 Reporting Bugs and Issues -If you think you've found a bug, first read the how to report a bug article and follow its instructions. - -If you're confident it's a new bug and have confirmed that someone else is facing the same issue, go ahead and create a new GitHub issue. Be sure to include as much information as possible so we can reproduce the bug. - -## How To Contribute -For Bit members, external contributors and company partners, please check out our guides at our wiki. -## Join Bit Project - -## License From 0263dbd0e14f902c51a4b0cf1f6ae3b4b70f40b5 Mon Sep 17 00:00:00 2001 From: Nathaniel Kong Date: Wed, 26 Feb 2020 00:59:08 -0800 Subject: [PATCH 06/14] Readded code of conduct, license, readme --- .gitignore | 4 --- CODE_OF_CONDUCT.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++ LICENSE | 21 +++++++++++++ README.md | 17 +++++++++++ 4 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 LICENSE create mode 100644 README.md diff --git a/.gitignore b/.gitignore index 9b2aa331..c098e050 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,3 @@ -CODE_OF_CONDUCT.md -LICENSE -README.md - Module4_Labs/.DS_Store Module4_Labs/Lab2_Doubly_Linked_List/.DS_Store Module4_Labs/Lab3_File_System/.DS_Store diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..d3c78b8e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at info@bitproject.org. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..753d7e05 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Bit Project + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..3b61c21d --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +![IMAGE ALT TEXT HERE](https://i.ibb.co/470bVsn/Bit-Project-2.png) +## Bit Project's Software Engineering Curriculum +Bit Project is a student club based in Davis, CA that creates resources for anyone to learn how to code. We value + +## About Us +We make software engineering and computer science education accessible to students from nontraditional learning environments. Using our curriculum, we take students with minimal experience in computer science to a full-fledged software developer with a diverse coding portfolio using our curriculum. We collaborate with leading companies and developers to create interactive, fun technical content that use industry standard technologies and developer tools. + +## 🐛 Reporting Bugs and Issues +If you think you've found a bug, first read the how to report a bug article and follow its instructions. + +If you're confident it's a new bug and have confirmed that someone else is facing the same issue, go ahead and create a new GitHub issue. Be sure to include as much information as possible so we can reproduce the bug. + +## How To Contribute +For Bit members, external contributors and company partners, please check out our guides at our wiki. +## Join Bit Project + +## License From eb6c76770200443fcdaae8ad8981dca3a18d9d14 Mon Sep 17 00:00:00 2001 From: christinazh <56854146+christinazh@users.noreply.github.com> Date: Wed, 26 Feb 2020 21:44:55 -0800 Subject: [PATCH 07/14] Update 213.md --- .../labs/Week 3/Democratic Debate Sentiment/213.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/213.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/213.md index e7466b3c..4347b0cd 100644 --- a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/213.md +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/213.md @@ -2,7 +2,13 @@ The `tweepy` package allows us to very easily use Twitter's API within a Python environment. The line below will give us an API object that will allow us to fetch tweets. +The wait_on_rate_limit will determine if the rate limits will replenish automatically. + +To fetch the tweets we will set the wait_on_rate_limit equal to True. + + ```python api = tw.API(auth, wait_on_rate_limit=True) ``` +After we retrieve the tweets, our next step will be to create authentification to use the app! From 702e6fe0b7686a40ad55a2de6ffc49e7dc7d2d81 Mon Sep 17 00:00:00 2001 From: christinazh <56854146+christinazh@users.noreply.github.com> Date: Wed, 26 Feb 2020 22:00:00 -0800 Subject: [PATCH 08/14] Update 212.md --- .../labs/Week 3/Democratic Debate Sentiment/212.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md index 0d30563d..afa83a71 100644 --- a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md @@ -14,3 +14,14 @@ auth.set_access_token(access_token, access_token_secret) This line enables access to our authentication object with our access token and access secret token. +A comsumer key is the API key that provides the consumer with a certain service. This will provide the consumers the key that +identifies them as the consumer. + +An access token is given to the consumer once they have completed the authorization. This token is provided by the service provider +and will determine what access benefits that consumer will recieve over a particular user's resources. When the consumer wants to access +data, they will need to provide the access token when requesting the information. + +There are both essential to an API because it will determine if the user is a consumer and when they need to access data, they need to +an access key or token. + +Once you have authenticated the credentials, we will begin creating the start code! From 2bec7cb23a0f4601d6fdba3ad1caa34b48740d00 Mon Sep 17 00:00:00 2001 From: christinazh <56854146+christinazh@users.noreply.github.com> Date: Wed, 26 Feb 2020 22:07:05 -0800 Subject: [PATCH 09/14] Update 211.md --- .../labs/Week 3/Democratic Debate Sentiment/211.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/211.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/211.md index e2315f0b..ef9f121b 100644 --- a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/211.md +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/211.md @@ -2,6 +2,8 @@ Remember all those credentials you generated? Paste them appropriately in the starter code. +We will need to add the following information in our code so we could retrieve the tweets! + ```python consumer_key = 'xxx' consumer_secret = 'xxx' @@ -9,3 +11,9 @@ access_token = 'xxx' access_token_secret = 'xxx' ``` +A comsumer key is the API key that provides the consumer with a certain service. This will provide the consumers the key that identifies them as the consumer. + +The consumer secret is the consumer's "password" that is used and also the onsumer key. These two information will be used +to request access to a user's resources from twitter. + +An access token is given to the consumer once they have completed the authorization. This token is provided by the service provider and will determine what access benefits that consumer will recieve over a particular user's resources. When the consumer wants to access data, they will need to provide the access token when requesting the information. From ce374ae3103bccc493cf432d8934281d02f72dc9 Mon Sep 17 00:00:00 2001 From: christinazh <56854146+christinazh@users.noreply.github.com> Date: Wed, 26 Feb 2020 22:09:56 -0800 Subject: [PATCH 10/14] Update 212.md --- .../labs/Week 3/Democratic Debate Sentiment/212.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md index afa83a71..bf8671f3 100644 --- a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/212.md @@ -14,14 +14,9 @@ auth.set_access_token(access_token, access_token_secret) This line enables access to our authentication object with our access token and access secret token. -A comsumer key is the API key that provides the consumer with a certain service. This will provide the consumers the key that -identifies them as the consumer. - -An access token is given to the consumer once they have completed the authorization. This token is provided by the service provider -and will determine what access benefits that consumer will recieve over a particular user's resources. When the consumer wants to access -data, they will need to provide the access token when requesting the information. - -There are both essential to an API because it will determine if the user is a consumer and when they need to access data, they need to +A comsumer key is different from an access token because this key is what differentiates the user as a consumer. +An access token on the other hand provides the consumers the access the user's resources. There are both essential to an API +because it will determine if the user is a consumer and when they need to access data, they need to have an access key or token. Once you have authenticated the credentials, we will begin creating the start code! From 037ec14c8575b0251ccabd0a817451ca7d928b03 Mon Sep 17 00:00:00 2001 From: christinazh <56854146+christinazh@users.noreply.github.com> Date: Sun, 1 Mar 2020 15:40:35 -0800 Subject: [PATCH 11/14] Update 2.md --- .../labs/Week 3/Democratic Debate Sentiment/2.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/2.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/2.md index ae5830ce..785101ad 100644 --- a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/2.md +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/2.md @@ -1,7 +1,7 @@ - -Paste your keys and tokens in the allocated space. Then configure OAuth authentication with your consumer key and secret, set your access tokens and create a API object in `tweepy` to fetch tweets. +So far we have created a twitter developer account and an application. We will next use our the keys and tokens that have been automatically generated to continue creating our API. -Bear in mind we will be using the `dem_search` dictionary for the rest of this lab. +We will need to paste the keys and tokens in the allocated space. Then configure OAuth authentication with your consumer key and secret, set your access tokens and create a API object in `tweepy` to fetch tweets. After the authentication process, we should have access to data on twitter. +Bear in mind we will be using the `dem_search` dictionary for the rest of this lab. From 21346dcde14a70ce431d3b885f196e9b814e5d1e Mon Sep 17 00:00:00 2001 From: christinazh <56854146+christinazh@users.noreply.github.com> Date: Sun, 1 Mar 2020 15:53:51 -0800 Subject: [PATCH 12/14] Update 21.md --- .../labs/Week 3/Democratic Debate Sentiment/21.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md index 77cae357..400617f3 100644 --- a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md @@ -3,6 +3,11 @@ Paste your keys and tokens in the allocated space. You'll want to authenticate in three steps: 1. Configure OAuth authentication with your consumer key and secret with the `OAuthHandler(consumer_key, consumer_secret)` call. This should create an `auth` object + + By configuring OAuth, it allows API client app to access a user's twitter account without having to handle or store the user's login info. + 2. Set your access tokens with `auth.set_access_token()`. + By setting the access tokens, it gives us authorization to a specific application that will give us access to specific parts of a user's data + 3. Create a API object in `tweepy` to fetch tweets: `tweepy.API(auth, wait_on_rate_limit=True)` - + This function will return the tweets. From 3dff53fcaf0f45b1aa9089d72c80a95e58b71eaa Mon Sep 17 00:00:00 2001 From: christinazh <56854146+christinazh@users.noreply.github.com> Date: Sun, 1 Mar 2020 15:54:35 -0800 Subject: [PATCH 13/14] Update 21.md --- .../labs/Week 3/Democratic Debate Sentiment/21.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md index 400617f3..1776fd51 100644 --- a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md @@ -4,10 +4,12 @@ Paste your keys and tokens in the allocated space. You'll want to authenticate i 1. Configure OAuth authentication with your consumer key and secret with the `OAuthHandler(consumer_key, consumer_secret)` call. This should create an `auth` object - By configuring OAuth, it allows API client app to access a user's twitter account without having to handle or store the user's login info. + By configuring OAuth authentication, it allows API client app to access a user's twitter account without having to handle or store the user's login info. 2. Set your access tokens with `auth.set_access_token()`. - By setting the access tokens, it gives us authorization to a specific application that will give us access to specific parts of a user's data + + Setting the access tokens gives us authorization to a specific application that will give us access to specific parts of a user's data 3. Create a API object in `tweepy` to fetch tweets: `tweepy.API(auth, wait_on_rate_limit=True)` + This function will return the tweets. From 9ab1937b8b8f504a93740354c3a035582770ff12 Mon Sep 17 00:00:00 2001 From: christinazh <56854146+christinazh@users.noreply.github.com> Date: Sun, 1 Mar 2020 15:54:51 -0800 Subject: [PATCH 14/14] Update 21.md --- .../labs/Week 3/Democratic Debate Sentiment/21.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md index 1776fd51..04dfde57 100644 --- a/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md +++ b/Module_Twitter_API/labs/Week 3/Democratic Debate Sentiment/21.md @@ -8,8 +8,8 @@ Paste your keys and tokens in the allocated space. You'll want to authenticate i 2. Set your access tokens with `auth.set_access_token()`. - Setting the access tokens gives us authorization to a specific application that will give us access to specific parts of a user's data + Setting the access tokens gives us authorization to a specific application that will give us access to specific parts of a user's data 3. Create a API object in `tweepy` to fetch tweets: `tweepy.API(auth, wait_on_rate_limit=True)` - This function will return the tweets. + This function will return the tweets.