Python Automation Cookbook: 75 Python automation ideas for web scraping, data wrangling, and processing Excel, reports, emails, and more

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Get a firm grip on the core processes including browser automation, web scraping, Word, Excel, and GUI automation with Python 3.8 and higher Key Features • Automate integral business processes such as report generation, email marketing, and lead generation • Explore automated code testing and Python's growth in data science and AI automation in three new chapters • Understand techniques to extract information and generate appealing graphs, and reports with Matplotlib Book Description In this updated and extended version of Python Automation Cookbook, each chapter now comprises the newest recipes and is revised to align with Python 3.8 and higher. The book includes three new chapters that focus on using Python for test automation, machine learning projects, and for working with messy data. This edition will enable you to develop a sharp understanding of the fundamentals required to automate business processes through real-world tasks, such as developing your first web scraping application, analyzing information to generate spreadsheet reports with graphs, and communicating with automatically generated emails. Once you grasp the basics, you will acquire the practical knowledge to create stunning graphs and charts using Matplotlib, generate rich graphics with relevant information, automate marketing campaigns, build machine learning projects, and execute debugging techniques. By the end of this book, you will be proficient in identifying monotonous tasks and resolving process inefficiencies to produce superior and reliable systems. What you will learn • Learn data wrangling with Python and Pandas for your data science and AI projects • Automate tasks such as text classification, email filtering, and web scraping with Python • Use Matplotlib to generate a variety of stunning graphs, charts, and maps • Automate a range of report generation tasks, from sending SMS and email campaigns to creating templates, adding images in Word, and even encrypting PDFs • Master web scraping and web crawling of popular file formats and directories with tools like Beautiful Soup • Build cool projects such as a Telegram bot for your marketing campaign, a reader from a news RSS feed, and a machine learning model to classify emails to the correct department based on their content • Create fire-and-forget automation tasks by writing cron jobs, log files, and regexes with Python scripting Who this book is for Python Automation Cookbook - Second Edition is for developers, data enthusiasts or anyone who wants to automate monotonous manual tasks related to business processes such as finance, sales, and HR, among others. Working knowledge of Python is all you need to get started with this book.

Author(s): Jaime Buelta
Edition: 2
Publisher: Packt Publishing
Year: 2020

Language: English
Commentary: True PDF
Pages: 526
City: Birmingham, UK
Tags: Google Cloud Platform; Machine Learning; Natural Language Processing; Computer Vision; Debugging; Python; Chatbots; Marketing; Data Visualization; Logging; Excel; Web Scraping; BeautifulSoup; Selenium; CSV; PDF; DOCX; matplotlib; pandas; Error Handling; Automation; Markdown; Spreadsheets; SMS; Telegram; PyTest; Testing; Regular Expressions; Text Processing; Email

Cover
Copyright
Packt Page
Contributors
Table of Contents
Preface
Chapter 1: Let's Begin Our Automation Journey
Activating a virtual environment
Installing third-party packages
Creating strings with formatted values
Manipulating strings
Extracting data from structured strings
Using a third-party tool—parse
Introducing regular expressions
Going deeper into regular expressions
Adding command-line arguments
Chapter 2: Automating Tasks Made Easy
Preparing a task
Setting up a cron job
Capturing errors and problems
Sending email notifications
Chapter 3: Building Your First Web Scraping Application
Downloading web pages
Parsing HTML
Crawling the web
Subscribing to feeds
Accessing web APIs
Interacting with forms
Using Selenium for advanced interaction
Accessing password-protected pages
Speeding up web scraping
Chapter 4: Searching and Reading Local Files
Crawling and searching directories
Reading text files
Dealing with encodings
Reading CSV files
Reading log files
Reading file metadata
Reading images
Reading PDF files
Reading Word documents
Scanning documents for a keyword
Chapter 5: Generating Fantastic Reports
Creating a simple report in plain text
Using templates for reports
Formatting text in Markdown
Writing a basic Word document
Styling a Word document
Generating structure in Word documents
Adding pictures to Word documents
Writing a simple PDF document
Structuring a PDF
Aggregating PDF reports
Watermarking and encrypting a PDF
Chapter 6: Fun with Spreadsheets
Writing a CSV spreadsheet
Updating CSV files
Reading an Excel spreadsheet
Updating an Excel spreadsheet
Creating new sheets in an Excel spreadsheet
Creating charts in Excel
Working with cell formats in Excel
Creating a macro in LibreOffice
Chapter 7: Cleaning and Processing Data
Prepare a CSV spreadsheet
Append currency based on location
Standardize the date format
Aggregate results
Process data in parallel
Process data with Pandas
Chapter 8: Developing Stunning Graphs
Plotting a simple sales graph
Drawing stacked bars
Plotting pie charts
Displaying multiple lines
Drawing a scatter plot
Visualizing maps
Adding legends and annotations
Combining graphs
Saving charts
Chapter 9: Dealing with Communication Channels
Working with email templates
Sending an individual email
Reading an email
Adding subscribers to an email newsletter
Sending notifications via email
Producing SMS messages
Receiving SMS
Creating a Telegram bot
Chapter 10: Why Not Automate Your Marketing Campaign?
Introduction
Detecting opportunities
Creating personalized coupon codes
Sending a notification to a customer on their preferred channel
Preparing sales information
Generating a sales report
Chapter 11: Machine Learning for Automation
Introduction
Analyse images with Google Cloud Vision AI
Extract text from images with Google Cloud Vision AI
Analyse text with Google Cloud Natural Language
Create your own custom machine learning model to classify text
Chapter 12: Automatic Testing Routines
Introduction
Write and execute test cases
Test external code
Test using dependency mocking
Test using HTTP call mocking
Prepare testing scenarios
Run tests selectively
Chapter 13: Debugging Techniques
Introduction
Learning Python interpreter basics
Debugging through logging
Debugging with breakpoints
Improving your debugging skills
Other Books You
May Enjoy
Index