Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Hands-On Web Scraping with Python - Second Edition

You're reading from  Hands-On Web Scraping with Python - Second Edition

Product type Book
Published in Oct 2023
Publisher Packt
ISBN-13 9781837636211
Pages 324 pages
Edition 2nd Edition
Languages
Author (1):
Anish Chapagain Anish Chapagain
Profile icon Anish Chapagain

Table of Contents (20) Chapters

Preface 1. Part 1:Python and Web Scraping
2. Chapter 1: Web Scraping Fundamentals 3. Chapter 2: Python Programming for Data and Web 4. Part 2:Beginning Web Scraping
5. Chapter 3: Searching and Processing Web Documents 6. Chapter 4: Scraping Using PyQuery, a jQuery-Like Library for Python 7. Chapter 5: Scraping the Web with Scrapy and Beautiful Soup 8. Part 3:Advanced Scraping Concepts
9. Chapter 6: Working with the Secure Web 10. Chapter 7: Data Extraction Using Web APIs 11. Chapter 8: Using Selenium to Scrape the Web 12. Chapter 9: Using Regular Expressions and PDFs 13. Part 4:Advanced Data-Related Concepts
14. Chapter 10: Data Mining, Analysis, and Visualization 15. Chapter 11: Machine Learning and Web Scraping 16. Part 5:Conclusion
17. Chapter 12: After Scraping – Next Steps and Data Analysis 18. Index 19. Other Books You May Enjoy

Data Mining, Analysis, and Visualization

So far, we have learned about some of the core Python libraries and techniques regarding HTTP/HTTPS communication, reading content, browser automation, and more from a data extraction perspective.

Data is the new oil (we all agree about this), but solely obtaining or collecting data does not provide any significant value. Collected data is stored in files (JSON, CSV, and XML), databases, and more. Stored data needs to be identified, searched, arranged, cleaned, transformed, explored, or modeled using algorithms and can sometimes be used by many services and applications before there’s any profit from the information from it.

Various technologies and concepts are involved in identifying and collecting data and processing it in order to extract some value. Data analysis implements and executes logic and algorithms using data-related applications and tools to generate valuable information. Visualization, on the other hand, displays...

Technical requirements

A web browser (Google Chrome or Mozilla Firefox) will be required, and we will be using JupyterLab for Python code.

Please refer to the Setting things up and Creating a virtual environment sections of Chapter 2 to continue with setting up and using the environment we have created. Refer to the following links to install and upgrade the required libraries:

The Python libraries that are required for this chapter are as follows:

  • csv
  • json
  • sqlite3

The code files for this chapter are available online in the book’s GitHub repository: https://github.com/PacktPublishing/Hands-On-Web-Scraping-with-Python-Second-Edition/tree/main/Chapter10.

Introduction to data mining

The term “mining” normally means the extraction or the process of extracting something. Data mining is the process of extracting data or discovering information from data. Data mining is a growing and ever-developing concept that discovers hidden, unexpected, and other various forms of information from datasets or databases, which helps in KD and decision-making.

In terms of data, mining is used as a form of analysis to discover patterns, hidden facts, and more. When knowledge is discovered using mining techniques, this is known as knowledge discovery in databases (KDD or knowledge discovery and data mining). There are plenty of terms used to describe data mining, such as KDD, information harvesting, pattern discovery from databases, and many more; although the final results are the same, these terms differ in the steps and processing architecture.

Important note

KDD is an almost cyclical process that has data mining as one of its...

Handling collected data

The availability of data is the main concern before attempting to process it for information and pattern detection. Handling collected data normally refers to gathering data in files and databases in some format and using it effectively and efficiently.

There are many tools and applications that handle data. Choosing the right tool or way of storing and using data shows your professionalism as a developer.

In the following sections, you will be learning about concepts related to handling files and dealing with types of files (JSON and CSV) that are in huge demand in the market and are associated with a large number of IT-driven applications.

Basic file handling

File handling is the core or basic technique for storing and reading data from files. This technique of handling and managing data is used a lot in various programming languages. File handling does not require additional software or tools unless some application extensions are used. Formatting...

Data analysis and visualization

Python programming is popular because of its easy usage and the availability of libraries for scientific computing, text computation, data analysis, machine learning, and much more. Data analysis is a systematic process. Unknown facts, hidden patterns, summary data, and a lot of other information can be obtained using data analysis. Data analysis is also treated as a subset of data science, and it has been booming with the use of Python and its features.

In this section, we will be analyzing some datasets, exploring some of the important features of pandas, and visualizing the results using plotly.

Analyzing data generally involves a few basic steps:

  1. Identify: Identify the source of data or the origin of data, such as a website, PDF file, or image.
  2. Collect: Collect the identified data using scraping or other techniques. Storing data is also important here.
  3. Clean: Preprocess and clean the collected data. Clean data is easier to process...

Summary

Generating and gathering information using different analysis techniques and using it for decision-making is a growing field. Fields such as business intelligence (BI), AI, and ML require, and use, various data analysis techniques. Python programming provides a great infrastructure for the processes of data collection, data processing, information abstraction, and knowledge discovery. Libraries such as pandas, NumPy, csv, json, and plotly are the core Python libraries of the overall systematic process.

A practical introduction to the concepts related to data mining, data analysis, EDA, and data visualization was the main agenda of this chapter.

In the next chapter, we will be learning about machine learning and web scraping.

Further reading

lock icon The rest of the chapter is locked
You have been reading a chapter from
Hands-On Web Scraping with Python - Second Edition
Published in: Oct 2023 Publisher: Packt ISBN-13: 9781837636211
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}