Learn how to write to an output file when scraping the web.
- [Instructor] Let me show you web scraping in action.…In the following demonstration, I'm going to show you…how to scrape webpage and then save your results…in an external file.…Let's get started.…For this demonstration, you're going to need…to import your Beautiful Soup library,…so we'll do that by saying…from…bs4…import BeautifulSoup,…and then we're going to need urllib library…in order to read in our data from the internet.…We'll say import…urllib,…and we also need to import the regular expression library,…so we'll say import re.…
Run that, and then we have our libraries.…Okay, we're going to scrape a page…from analytics….usa….gov.…Let's call our variable r, and then we're going to call…the urlopen function, so we say…url…lib….urlopen,…and then we'll pass in…the URL of the page we want to scrape,…and we'll say analytics….usa….gov…and then .read.…
Just remember, you can use…any web link you want here, so you can basically…scrape any page from the internet.…Now, let's create a Beautiful Soup object.…We'll call it soup, and we'll call our Beautiful Soup…
AuthorLillian Pierson, P.E.
- Getting started with Jupyter Notebooks
- Visualizing data: basic charts, time series, and statistical plots
- Preparing for analysis: treating missing values and data transformation
- Data analysis basics: arithmetic, summary statistics, and correlation analysis
- Outlier analysis: univariate, multivariate, and linear projection methods
- Introduction to machine learning
- Basic machine learning methods: linear and logistic regression, Naïve Bayes
- Reducing dataset dimensionality with PCA
- Clustering and classification: k-means, hierarchical, and k-NN
- Simulating a social network with NetworkX
- Creating Plot.ly charts
- Scraping the web with Beautiful Soup
Skill Level Beginner
1. Data Munging Basics
2. Data Visualization Basics
3. Basic Math and Statistics
4. Dimensionality Reduction
Explanatory factor analysis6m 39s
5. Outlier Analysis
6. Cluster Analysis
7. Network Analysis with NetworkX
8. Basic Algorithmic Learning
9. Web-based Data Visualizations with Plotly
10. Web Scraping with Beautiful Soup
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.