Wednesday 31 January 2024

Mastering Python Networking: Utilize Python packages and frameworks for network automation, monitoring, cloud, and management, 4th Edition

 


Get to grips with the latest container examples, Python 3 features, GitLab DevOps, network data analysis, and cloud networking to get the most out of Python for network engineering with the latest edition of this bestselling guide

Purchase of the print or Kindle book includes a free eBook in PDF format.

Key Features

Explore the power of the latest Python libraries and frameworks to tackle common and complex network problems efficiently and effectively

Use Python and other open source tools for Network DevOps, automation, management, and monitoring

Use Python 3 to implement advanced network-related features

Book Description

Networks in your infrastructure set the foundation for how your application can be deployed, maintained, and serviced. Python is the ideal language for network engineers to explore tools that were previously available to systems engineers and application developers. In Mastering Python Networking, Fourth edition, you'll embark on a Python-based journey to transition from a traditional network engineer to a network developer ready for the next generation of networks.

This new edition is completely revised and updated to work with the latest Python features and DevOps frameworks. In addition to new chapters on introducing Docker containers and Python 3 Async IO for network engineers, each chapter is updated with the latest libraries with working examples to ensure compatibility and understanding of the concepts.

Starting with a basic overview of Python, the book teaches you how it can interact with both legacy and API-enabled network devices. You will learn to leverage high-level Python packages and frameworks to perform network automation tasks, monitoring, management, and enhanced network security, followed by AWS and Azure cloud networking. You will use Git for code management, GitLab for continuous integration, and Python-based testing tools to verify your network.

What you will learn

Use Python to interact with network devices

Understand Docker as a tool that you can use for the development and deployment

Use Python and various other tools to obtain information from the network

Learn how to use ELK for network data analysis

Utilize Flask and construct high-level API to interact with in-house applications

Discover the new AsyncIO feature and its concepts in Python 3

Explore test-driven development concepts and use PyTest to drive code test coverage

Understand how GitLab can be used with DevOps practices in networking

Who this book is for

Mastering Python Networking, Fourth edition is for network engineers, developers, and SREs who want to learn Python for network automation, programmability, monitoring, cloud, and data analysis. Network engineers who want to transition from manual to automation-based networks using the latest DevOps tools will also get a lot of useful information from this book.

Basic familiarity with Python programming and networking-related concepts such as Transmission Control Protocol/Internet Protocol (TCP/IP) will be helpful in getting the most out of this book.

Table of Contents

Review of TCP/IP Protocol Suite and Python

Low-Level Network Device Interactions

APIs and Intent-Driven Networking

The Python Automation Framework – Ansible

Docker Containers for Network Engineers

Network Security with Python

Network Monitoring with Python - Part 1

Network Monitoring with Python - Part 2

Building Network Web Services with Python

Introduction to AsyncIO

AWS Cloud Networking

Azure Cloud Networking

Hard Copy: Mastering Python Networking: Utilize Python packages and frameworks for network automation, monitoring, cloud, and management, 4th Edition


Python for Finance Cookbook: Over 50 recipes for applying modern Python libraries to financial data analysis 1st Edition

 


Solve common and not-so-common financial problems using Python libraries such as NumPy, SciPy, and pandas

Key Features

Use powerful Python libraries such as pandas, NumPy, and SciPy to analyze your financial data

Explore unique recipes for financial data analysis and processing with Python

Estimate popular financial models such as CAPM and GARCH using a problem-solution approach

Book Description

Python is one of the most popular programming languages used in the financial industry, with a huge set of accompanying libraries.

In this book, you'll cover different ways of downloading financial data and preparing it for modeling. You'll calculate popular indicators used in technical analysis, such as Bollinger Bands, MACD, RSI, and backtest automatic trading strategies. Next, you'll cover time series analysis and models, such as exponential smoothing, ARIMA, and GARCH (including multivariate specifications), before exploring the popular CAPM and the Fama-French three-factor model. You'll then discover how to optimize asset allocation and use Monte Carlo simulations for tasks such as calculating the price of American options and estimating the Value at Risk (VaR). In later chapters, you'll work through an entire data science project in the financial domain. You'll also learn how to solve the credit card fraud and default problems using advanced classifiers such as random forest, XGBoost, LightGBM, and stacked models. You'll then be able to tune the hyperparameters of the models and handle class imbalance. Finally, you'll focus on learning how to use deep learning (PyTorch) for approaching financial tasks.

By the end of this book, you’ll have learned how to effectively analyze financial data using a recipe-based approach.

What you will learn

Download and preprocess financial data from different sources

Backtest the performance of automatic trading strategies in a real-world setting

Estimate financial econometrics models in Python and interpret their results

Use Monte Carlo simulations for a variety of tasks such as derivatives valuation and risk assessment

Improve the performance of financial models with the latest Python libraries

Apply machine learning and deep learning techniques to solve different financial problems

Understand the different approaches used to model financial time series data

Who this book is for

This book is for financial analysts, data analysts, and Python developers who want to learn how to implement a broad range of tasks in the finance domain. Data scientists looking to devise intelligent financial strategies to perform efficient financial analysis will also find this book useful. Working knowledge of the Python programming language is mandatory to grasp the concepts covered in the book effectively.

Table of Contents

Financial Data and Preprocessing

Technical Analysis in Python

Time Series Modelling

Multi-factor Models

Modeling Volatility with GARCH class models

Monte Carlo Simulations in Finance

Asset Allocation in Python

Identifying Credit Default with Machine Learning

Advanced Machine Learning Models in Finance

Deep Learning in Finance

Hard Copy: Python for Finance Cookbook: Over 50 recipes for applying modern Python libraries to financial data analysis 1st Edition

Python Data Cleaning Cookbook: Modern techniques and Python tools to detect and remove dirty data and extract key insights

 


Discover how to describe your data in detail, identify data issues, and find out how to solve them using commonly used techniques and tips and tricks

Key Features

Get well-versed with various data cleaning techniques to reveal key insights

Manipulate data of different complexities to shape them into the right form as per your business needs

Clean, monitor, and validate large data volumes to diagnose problems before moving on to data analysis

Book Description

Getting clean data to reveal insights is essential, as directly jumping into data analysis without proper data cleaning may lead to incorrect results. This book shows you tools and techniques that you can apply to clean and handle data with Python. You'll begin by getting familiar with the shape of data by using practices that can be deployed routinely with most data sources. Then, the book teaches you how to manipulate data to get it into a useful form. You'll also learn how to filter and summarize data to gain insights and better understand what makes sense and what does not, along with discovering how to operate on data to address the issues you've identified. Moving on, you'll perform key tasks, such as handling missing values, validating errors, removing duplicate data, monitoring high volumes of data, and handling outliers and invalid dates. Next, you'll cover recipes on using supervised learning and Naive Bayes analysis to identify unexpected values and classification errors, and generate visualizations for exploratory data analysis (EDA) to visualize unexpected values. Finally, you'll build functions and classes that you can reuse without modification when you have new data.

By the end of this Python book, you'll be equipped with all the key skills that you need to clean data and diagnose problems within it.

What you will learn

Find out how to read and analyze data from a variety of sources

Produce summaries of the attributes of data frames, columns, and rows

Filter data and select columns of interest that satisfy given criteria

Address messy data issues, including working with dates and missing values

Improve your productivity in Python pandas by using method chaining

Use visualizations to gain additional insights and identify potential data issues

Enhance your ability to learn what is going on in your data

Build user-defined functions and classes to automate data cleaning

Who this book is for

This book is for anyone looking for ways to handle messy, duplicate, and poor data using different Python tools and techniques. The book takes a recipe-based approach to help you to learn how to clean and manage data. Working knowledge of Python programming is all you need to get the most out of the book.

Table of Contents

Anticipating Data Cleaning Issues when Importing Tabular Data into pandas

Anticipating Data Cleaning Issues when Importing HTML and JSON into Pandas

Taking the Measure of Your Data

Identifying Issues in Subsets of Data

Using Visualizations for Exploratory Data Analysis

Cleaning and Wrangling Data with Pandas Data Series Operations

Fixing Messy Data When Aggregating

Addressing Data Issues When Combining Data Frames

Tidying and Reshaping Data

User Defined Functions and Classes to Automate Data Cleaning

Hard Copy: Python Data Cleaning Cookbook: Modern techniques and Python tools to detect and remove dirty data and extract key insights

Python Basics: A Practical Introduction to Python 3

 


Make the Leap From Beginner to Intermediate in Python…

Python Basics: A Practical Introduction to Python 3

Your Complete Python Curriculum—With Exercises, Interactive Quizzes, and Sample Projects

What should you learn about Python in the beginning to get a strong foundation? With Python Basics, you’ll not only cover the core concepts you really need to know, but you’ll also learn them in the most efficient order with the help of practical exercises and interactive quizzes. You’ll know enough to be dangerous with Python, fast!

Who Should Read This Book

If you’re new to Python, you’ll get a practical, step-by-step roadmap on developing your foundational skills. You’ll be introduced to each concept and language feature in a logical order. Every step in this curriculum is explained and illustrated with short, clear code samples. Our goal with this book is to educate, not to impress or intimidate.

If you’re familiar with some basic programming concepts, you’ll get a clear and well-tested introduction to Python. This is a practical introduction to Python that jumps right into the meat and potatoes without sacrificing substance. If you have prior experience with languages like VBA, PowerShell, R, Perl, C, C++, C#, Java, or Swift the numerous exercises within each chapter will fast-track your progress.

If you’re a seasoned developer, you’ll get a Python 3 crash course that brings you up to speed with modern Python programming. Mix and match the chapters that interest you the most and use the interactive quizzes and review exercises to check your learning progress as you go along.

If you’re a self-starter completely new to coding, you’ll get practical and motivating examples. You’ll begin by installing Python and setting up a coding environment on your computer from scratch, and then continue from there. We’ll get you coding right away so that you become competent and knowledgeable enough to solve real-world problems, fast. Develop a passion for programming by solving interesting problems with Python every day!

If you’re looking to break into a coding or data-science career, you’ll pick up the practical foundations with this book. We won’t just dump a boat load of theoretical information on you so you can “sink or swim”—instead you’ll learn from hands-on, practical examples one step at a time. Each concept is broken down for you so you’ll always know what you can do with it in practical terms.

If you’re interested in teaching others “how to Python,” this will be your guidebook. If you’re looking to stoke the coding flame in your coworkers, kids, or relatives—use our material to teach them. All the sequencing has been done for you so you’ll always know what to cover next and how to explain it.

What Python Developers Say About The Book:

“Go forth and learn this amazing language using this great book.” — Michael Kennedy, Talk Python

“The wording is casual, easy to understand, and makes the information flow well.” — Thomas Wong, Pythonista

“I floundered for a long time trying to teach myself. I slogged through dozens of incomplete online tutorials. I snoozed through hours of boring screencasts. I gave up on countless crufty books from big-time publishers. And then I found Real Python. The easy-to-follow, step-by-step instructions break the big concepts down into bite-sized chunks written in plain English. The authors never forget their audience and are consistently thorough and detailed in their explanations. I’m up and running now, but I constantly refer to the material for guidance.” — Jared Nielsen, Pythonista

Hard Copy : Python Basics: A Practical Introduction to Python 3

Artificial Intelligence with Python Cookbook: Proven recipes for applying AI algorithms and deep learning techniques using TensorFlow 2.x and PyTorch 1.6

 



Work through practical recipes to learn how to solve complex machine learning and deep learning problems using Python

Key Features

Get up and running with artificial intelligence in no time using hands-on problem-solving recipes

Explore popular Python libraries and tools to build AI solutions for images, text, sounds, and images

Implement NLP, reinforcement learning, deep learning, GANs, Monte-Carlo tree search, and much more

Book Description

Artificial intelligence (AI) plays an integral role in automating problem-solving. This involves predicting and classifying data and training agents to execute tasks successfully. This book will teach you how to solve complex problems with the help of independent and insightful recipes ranging from the essentials to advanced methods that have just come out of research.

Artificial Intelligence with Python Cookbook starts by showing you how to set up your Python environment and taking you through the fundamentals of data exploration. Moving ahead, you’ll be able to implement heuristic search techniques and genetic algorithms. In addition to this, you'll apply probabilistic models, constraint optimization, and reinforcement learning. As you advance through the book, you'll build deep learning models for text, images, video, and audio, and then delve into algorithmic bias, style transfer, music generation, and AI use cases in the healthcare and insurance industries. Throughout the book, you’ll learn about a variety of tools for problem-solving and gain the knowledge needed to effectively approach complex problems.

By the end of this book on AI, you will have the skills you need to write AI and machine learning algorithms, test them, and deploy them for production.

What you will learn

Implement data preprocessing steps and optimize model hyperparameters

Delve into representational learning with adversarial autoencoders

Use active learning, recommenders, knowledge embedding, and SAT solvers

Get to grips with probabilistic modeling with TensorFlow probability

Run object detection, text-to-speech conversion, and text and music generation

Apply swarm algorithms, multi-agent systems, and graph networks

Go from proof of concept to production by deploying models as microservices

Understand how to use modern AI in practice

Who this book is for

This AI machine learning book is for Python developers, data scientists, machine learning engineers, and deep learning practitioners who want to learn how to build artificial intelligence solutions with easy-to-follow recipes. You’ll also find this book useful if you’re looking for state-of-the-art solutions to perform different machine learning tasks in various use cases. Basic working knowledge of the Python programming language and machine learning concepts will help you to work with code effectively in this book.

Table of Contents

Getting Started with Artificial Intelligence in Python

Advanced Topics in Supervised Machine Learning

Patterns, Outliers, and Recommendations

Probabilistic Modeling

Heuristic Search Techniques and Logical Inference

Deep Reinforcement Learning

Advanced Image Applications

Working with Moving Images

Deep Learning in Audio and Speech

Natural Language Processing

Artificial Intelligence in Production

Hard Copy: Artificial Intelligence with Python Cookbook: Proven recipes for applying AI algorithms and deep learning techniques using TensorFlow 2.x and PyTorch 1.6

Tuesday 30 January 2024

Distance Measures in Data Science with Algorithms

Distance Measures in data science with algorithms

1. Euclidean Distance:

import numpy as np

def euclidean_distance(p1, p2):
    return np.sqrt(np.sum((p1 - p2) ** 2))

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Euclidean distance:", euclidean_distance(point1, point2))

#clcoding.com
Euclidean distance: 2.8284271247461903


2. Manhattan Distance:

import numpy as np

def manhattan_distance(p1, p2):
    return np.sum(np.abs(p1 - p2))

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Manhattan distance:", manhattan_distance(point1, point2))

#clcoding.com
Manhattan distance: 4



3. Cosine Similarity:

from scipy.spatial import distance

def cosine_similarity(p1, p2):
    return 1 - distance.cosine(p1, p2)

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Cosine similarity:", cosine_similarity(point1, point2))

#clcoding.com
Cosine similarity: 0.9838699100999074

4. Minkowski Distance:

import numpy as np

def minkowski_distance(p1, p2, r):
    return np.power(np.sum(np.power(np.abs(p1 - p2), r)), 1/r)

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Minkowski distance:", minkowski_distance(point1, point2, 3))

#clcoding.com
Minkowski distance: 2.5198420997897464



5. Chebyshev Distance:

import numpy as np

def chebyshev_distance(p1, p2):
    return np.max(np.abs(p1 - p2))

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Chebyshev distance:", chebyshev_distance(point1, point2))

#clcoding.com
Chebyshev distance: 2


6. Hamming Distance:

import jellyfish

def hamming_distance(s1, s2):
    return jellyfish.hamming_distance(s1, s2)

# Example usage
string1 = "hello"
string2 = "hallo"
print("Hamming distance:", hamming_distance(string1, string2))

#clcoding.com
Hamming distance: 1



7. Jaccard Similarity:

def jaccard_similarity(s1, s2):
    set1 = set(s1)
    set2 = set(s2)
    intersection = set1.intersection(set2)
    union = set1.union(set2)
    return len(intersection) / len(union)

# Example usage
string1 = "hello"
string2 = "hallo"
print("Jaccard similarity:", jaccard_similarity(string1, string2))

#clcoding.com
Jaccard similarity: 0.6

8. Sørensen-Dice Index:

def sorensen_dice_index(s1, s2):
    set1 = set(s1)
    set2 = set(s2)
    intersection = set1.intersection(set2)
    return (2 * len(intersection)) / (len(set1) + len(set2))

# Example usage
string1 = "hello"
string2 = "hallo"
print("Sørensen-Dice index:", sorensen_dice_index(string1, string2))

#clcoding.com
Sørensen-Dice index: 0.75



9. Haversine Distance:

def haversine_distance(lat1, lon1, lat2, lon2):
    R = 6371.0  # Radius of the earth in km
    dLat = np.deg2rad(lat2 - lat1)
    dLon = np.deg2rad(lon2 - lon1)
    a = np.sin(dLat / 2)**2 + np.cos(np.deg2rad(lat1)) * np.cos(np.deg2rad(lat2)) * np.sin(dLon / 2)**2
    c = 2 * np.arctan2(np.sqrt(a), np.sqrt(1 - a))
    return R * c

# Example usage
print("Haversine distance:", haversine_distance(51.5074, 0.1278, 40.7128, -74.0060))

#clcoding.com
  Input In [14]
    a = np.sin(dLat / 2)**2 + np.cos(np.deg2rad(lat1)) *
                                                         ^
SyntaxError: invalid syntax

10. Mahalanobis Distance:

from scipy.spatial.distance import cdist

def mahalanobis_distance(X, Y):
    return cdist(X.reshape(1,-1), Y.reshape(1,-1), 'mahalanobis', VI=np.cov(X))

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Mahalanobis distance:", mahalanobis_distance(point1, point2))

#clcoding.com
Mahalanobis distance: [[1.41421356]]



11. Pearson Correlation:

from scipy.stats import pearsonr

def pearson_correlation(X, Y):
    return pearsonr(X, Y)[0]

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Pearson correlation:", pearson_correlation(point1, point2))

#clcoding.com
Pearson correlation: 1.0

12. Squared Euclidean Distance:

def squared_euclidean_distance(X, Y):
    return euclidean_distance(X, Y)**2

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Squared Euclidean distance:", squared_euclidean_distance(point1, point2))

#clcoding.com
Squared Euclidean distance: 8.000000000000002



13. Jensen-Shannon Divergence:

def jensen_shannon_divergence(X, Y):
    M = 0.5 * (X + Y)
    return np.sqrt(0.5 * (rel_entr(X, M).sum() + rel_entr(Y, M).sum()))

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Jensen-Shannon divergence:", jensen_shannon_divergence(point1, point2))

#clcoding.com
Jensen-Shannon divergence: 0.6569041853099059

14. Chi-Square Distance:

def chi_square_distance(X, Y):
    X = X / np.sum(X)
    Y = Y / np.sum(Y)
    return np.sum((X - Y) ** 2 / (X + Y))

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Chi-Square distance:", chi_square_distance(point1, point2))

#clcoding.com
Chi-Square distance: 0.01923076923076923



15. Spearman Correlation:

from scipy.stats import spearmanr

def spearman_correlation(X, Y):
    return spearmanr(X, Y)[0]

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Spearman correlation:", spearman_correlation(point1, point2))

#clcoding.com
Spearman correlation: 0.9999999999999999

16. Canberra Distance:

from scipy.spatial.distance import canberra

def canberra_distance(X, Y):
    return canberra(X, Y)

# Example usage
point1 = np.array([1, 2])
point2 = np.array([3, 4])
print("Canberra distance:", canberra_distance(point1, point2))

#clcoding.com
Canberra distance: 0.8333333333333333



Monday 29 January 2024

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

 


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.

Table of Contents

Let's Begin Our Automation Journey

Automating Tasks Made Easy

Building Your First Web Scraping Application

Searching and Reading Local Files

Generating Fantastic Reports

Fun with Spreadsheets

Cleaning and Processing Data

Developing Stunning Graphs

Dealing with Communication Channels

Why Not Automate Your Marketing Campaign?

Machine Learning for Automation

Automatic Testing Routines

Debugging Techniques

Hard Copy : Python Automation Cookbook: 75 Python automation ideas for web scraping, data wrangling, and processing Excel, reports, emails, and more, 2nd Edition

Hands-On Data Structures and Algorithms with Python: Store, manipulate, and access data effectively and boost the performance of your applications, 3rd Edition

 


Understand how implementing different data structures and algorithms intelligently can make your Python code and applications more maintainable and efficient

Key Features

Explore functional and reactive implementations of traditional and advanced data structures

Apply a diverse range of algorithms in your Python code

Implement the skills you have learned to maximize the performance of your applications

Book Description

Choosing the right data structure is pivotal to optimizing the performance and scalability of applications. This new edition of Hands-On Data Structures and Algorithms with Python will expand your understanding of key structures, including stacks, queues, and lists, and also show you how to apply priority queues and heaps in applications. You'll learn how to analyze and compare Python algorithms, and understand which algorithms should be used for a problem based on running time and computational complexity. You will also become confident organizing your code in a manageable, consistent, and scalable way, which will boost your productivity as a Python developer.

By the end of this Python book, you'll be able to manipulate the most important data structures and algorithms to more efficiently store, organize, and access data in your applications.

What you will learn

Understand common data structures and algorithms using examples, diagrams, and exercises

Explore how more complex structures, such as priority queues and heaps, can benefit your code

Implement searching, sorting, and selection algorithms on number and string sequences

Become confident with key string-matching algorithms

Understand algorithmic paradigms and apply dynamic programming techniques

Use asymptotic notation to analyze algorithm performance with regard to time and space complexities

Write powerful, robust code using the latest features of Python

Who this book is for

This book is for developers and programmers who are interested in learning about data structures and algorithms in Python to write complex, flexible programs. Basic Python programming knowledge is expected.

Table of Contents

Python Data Types and Structures

Introduction to Algorithm Design

Algorithm Design Techniques and Strategies

Linked Lists

Stacks and Queues

Trees

Heaps and Priority Queues

Hash Tables

Graphs and Algorithms

Searching

Sorting

Selection Algorithms

String Matching Algorithms

Appendix: Answers to the Questions

Hard Copy: Hands-On Data Structures and Algorithms with Python: Store, manipulate, and access data effectively and boost the performance of your applications, 3rd Edition

Mastering Python: Write powerful and efficient code using the full range of Python's capabilities, 2nd Edition

 


Use advanced features of Python to write high-quality, readable code and packages

Key Features

Extensively updated for Python 3.10 with new chapters on design patterns, scientific programming, machine learning, and interactive Python

Shape your scripts using key concepts like concurrency, performance optimization, asyncio, and multiprocessing

Learn how advanced Python features fit together to produce maintainable code

Book Description

Even if you find writing Python code easy, writing code that is efficient, maintainable, and reusable is not so straightforward. Many of Python's capabilities are underutilized even by more experienced programmers. Mastering Python, Second Edition, is an authoritative guide to understanding advanced Python programming so you can write the highest quality code. This new edition has been extensively revised and updated with exercises, four new chapters and updates up to Python 3.10.

Revisit important basics, including Pythonic style and syntax and functional programming. Avoid common mistakes made by programmers of all experience levels. Make smart decisions about the best testing and debugging tools to use, optimize your code's performance across multiple machines and Python versions, and deploy often-forgotten Python features to your advantage. Get fully up to speed with asyncio and stretch the language even further by accessing C functions with simple Python calls. Finally, turn your new-and-improved code into packages and share them with the wider Python community.

If you are a Python programmer wanting to improve your code quality and readability, this Python book will make you confident in writing high-quality scripts and taking on bigger challenges

What you will learn

Write beautiful Pythonic code and avoid common Python coding mistakes

Apply the power of decorators, generators, coroutines, and metaclasses

Use different testing systems like pytest, unittest, and doctest

Track and optimize application performance for both memory and CPU usage

Debug your applications with PDB, Werkzeug, and faulthandler

Improve your performance through asyncio, multiprocessing, and distributed computing

Explore popular libraries like Dask, NumPy, SciPy, pandas, TensorFlow, and scikit-learn

Extend Python's capabilities with C/C++ libraries and system calls

Who this book is for

This book will benefit more experienced Python programmers who wish to upskill, serving as a reference for best practices and some of the more intricate Python techniques. Even if you have been using Python for years, chances are that you haven't yet encountered every topic discussed in this book. A good understanding of Python programming is necessary

Table of Contents

Getting Started – One Environment per Project

Interactive Python Interpreters

Pythonic Syntax and Common Pitfalls

Pythonic Design Patterns

Functional Programming – Readability Versus Brevity

Decorators – Enabling Code Reuse by Decorating

Generators and Coroutines – Infinity, One Step at a Time

Metaclasses – Making Classes (Not Instances) Smarter

Documentation – How to Use Sphinx and reStructuredText

Testing and Logging – Preparing for Bugs

Debugging – Solving the Bugs

Performance – Tracking and Reducing Your Memory and CPU Usage

asyncio – Multithreading without Threads

Multiprocessing – When a Single CPU Core Is Not Enough

Scientific Python and Plotting

Artificial Intelligence

Extensions in C/C++, System Calls, and C/C++ Libraries

Packaging – Creating Your Own Libraries or Applications

Hard Copy : Mastering Python: Write powerful and efficient code using the full range of Python's capabilities, 2nd Edition

Learn Python Programming: An in-depth introduction to the fundamentals of Python, 3rd Edition

 


Get up and running with Python 3.9 through concise tutorials and practical projects in this fully updated third edition.

Purchase of the print or Kindle book includes a free eBook in PDF format.

Key Features

Extensively revised with richer examples, Python 3.9 syntax, and new chapters on APIs and packaging and distributing Python code

Discover how to think like a Python programmer

Learn the fundamentals of Python through real-world projects in API development, GUI programming, and data science

Book Description

Learn Python Programming, Third Edition is both a theoretical and practical introduction to Python, an extremely flexible and powerful programming language that can be applied to many disciplines. This book will make learning Python easy and give you a thorough understanding of the language. You'll learn how to write programs, build modern APIs, and work with data by using renowned Python data science libraries.

This revised edition covers the latest updates on API management, packaging applications, and testing. There is also broader coverage of context managers and an updated data science chapter.

The book empowers you to take ownership of writing your software and become independent in fetching the resources you need. You will have a clear idea of where to go and how to build on what you have learned from the book.

Through examples, the book explores a wide range of applications and concludes by building real-world Python projects based on the concepts you have learned.

What you will learn

Get Python up and running on Windows, Mac, and Linux

Write elegant, reusable, and efficient code in any situation

Avoid common pitfalls like duplication, complicated design, and over-engineering

Understand when to use the functional or object-oriented approach to programming

Build a simple API with FastAPI and program GUI applications with Tkinter

Get an initial overview of more complex topics such as data persistence and cryptography

Fetch, clean, and manipulate data, making efficient use of Python’s built-in data structures

Who this book is for

This book is for everyone who wants to learn Python from scratch, as well as experienced programmers looking for a reference book. Prior knowledge of basic programming concepts will help you follow along, but it’s not a prerequisite.

Table of Contents

A Gentle Introduction to Python

Built-In Data Types

Conditionals and Iteration

Functions, the Building Blocks of Code

Comprehensions and Generators

OOP, Decorators, and Iterators

Exceptions and Context Managers

Files and Data Persistence

Cryptography and Tokens

Testing

Debugging and Profiling

GUIs and Scripting

Data Science in Brief

Introduction to API Development

Packaging Python Applications

Hard Copy : Learn Python Programming: An in-depth introduction to the fundamentals of Python, 3rd Edition

Python Object-Oriented Programming: Build robust and maintainable object-oriented Python applications and libraries, 4th Edition

 


A comprehensive guide to exploring modern Python through data structures, design patterns, and effective object-oriented techniques

Key Features

Build an intuitive understanding of object-oriented design, from introductory to mature programs

Learn the ins and outs of Python syntax, libraries, and best practices

Examine a machine-learning case study at the end of each chapter

Book Description

Object-oriented programming (OOP) is a popular design paradigm in which data and behaviors are encapsulated in such a way that they can be manipulated together. Python Object-Oriented Programming, Fourth Edition dives deep into the various aspects of OOP, Python as an OOP language, common and advanced design patterns, and hands-on data manipulation and testing of more complex OOP systems. These concepts are consolidated by open-ended exercises, as well as a real-world case study at the end of every chapter, newly written for this edition. All example code is now compatible with Python 3.9+ syntax and has been updated with type hints for ease of learning.

Steven and Dusty provide a comprehensive, illustrative tour of important OOP concepts, such as inheritance, composition, and polymorphism, and explain how they work together with Python's classes and data structures to facilitate good design. In addition, the book also features an in-depth look at Python's exception handling and how functional programming intersects with OOP. Two very powerful automated testing systems, unittest and pytest, are introduced. The final chapter provides a detailed discussion of Python's concurrent programming ecosystem.

By the end of the book, you will have a thorough understanding of how to think about and apply object-oriented principles using Python syntax and be able to confidently create robust and reliable programs.

What you will learn

Implement objects in Python by creating classes and defining methods

Extend class functionality using inheritance

Use exceptions to handle unusual situations cleanly

Understand when to use object-oriented features, and more importantly, when not to use them

Discover several widely used design patterns and how they are implemented in Python

Uncover the simplicity of unit and integration testing and understand why they are so important

Learn to statically type check your dynamic code

Understand concurrency with asyncio and how it speeds up programs

Who this book is for

If you are new to object-oriented programming techniques, or if you have basic Python skills and wish to learn how and when to correctly apply OOP principles in Python, this is the book for you. Moreover, if you are an object-oriented programmer coming from other languages or seeking a leg up in the new world of Python, you will find this book a useful introduction to Python. Minimal previous experience with Python is necessary.

Table of Contents

Object-Oriented Design

Objects in Python

When Objects Are Alike

Expecting the Unexpected

When to Use Object-Oriented Programming

Abstract Base Classes and Operator Overloading

Python Data Structures

The Intersection of Object-Oriented and Functional Programming

Strings, Serialization, and File Paths

The Iterator Pattern

Common Design Patterns

Advanced Design Patterns

Testing Object-Oriented Programs

Concurrency

Hard Copy: Python Object-Oriented Programming: Build robust and maintainable object-oriented Python applications and libraries, 4th Edition

Sunday 28 January 2024

Coding for Kids: Python: Learn to Code with 50 Awesome Games and Activities

 


Games and activities that teach kids ages 10+ to code with Python

Learning to code isn't as hard as it sounds—you just have to get started! Coding for Kids: Python starts kids off right with 50 fun, interactive activities that teach them the basics of the Python programming language. From learning the essential building blocks of programming to creating their very own games, kids will progress through unique lessons packed with helpful examples—and a little silliness!

Kids will follow along by starting to code (and debug their code) step by step, seeing the results of their coding in real time. Activities at the end of each chapter help test their new knowledge by combining multiple concepts. For young programmers who really want to show off their creativity, there are extra tricky challenges to tackle after each chapter. All kids need to get started is a computer and this book.

This beginner's guide to Python for kids includes:

50 Innovative exercises—Coding concepts come to life with game-based exercises for creating code blocks, drawing pictures using a prewritten module, and more.

Easy-to-follow guidance—New coders will be supported by thorough instructions, sample code, and explanations of new programming terms.

Engaging visual lessons—Colorful illustrations and screenshots for reference help capture kids' interest and keep lessons clear and simple.

Encourage kids to think independently and have fun learning an amazing new skill with this coding book for kids.

Hard Copy : Coding for Kids: Python: Learn to Code with 50 Awesome Games and Activities

Sprial Bound : Coding for Kids: Python: Learn to Code with 50 Awesome Games and Activities [Spiral-bound] Adrienne Tacke

PDF : Coding for Kids: Python: Learn to Code with 50 Awesome Games and Activities [Spiral-bound] Adrienne Tacke


Saturday 27 January 2024

Image Processing in Python using Pillow


Image Processing in Python
#original Image

from PIL import Image
Image.open('clcodingmr.jpg')





1. Image Resizing:

from PIL import Image

def resize_image(image_path, output_path, width, height):
    image = Image.open(image_path)
    resized_image = image.resize((width, height))
    resized_image.save(output_path)

# Example usage:
resize_image('clcodingmr.jpg', 'resized_output.jpg', 300, 200)

# Now, open and show the resized image
Image.open('clcodingmr.jpg')
Image.open('resized_output.jpg')




2. Image Rotation with Pillow:

from PIL import Image
def rotate_image(image_path, output_path, angle):
    image = Image.open(image_path)
    rotated_image = image.rotate(angle)
    rotated_image.save(output_path)
# Example usage:
rotate_image('clcodingmr.jpg', 'rotated_output.jpg', 45)
Image.open('rotated_output.jpg')




3. Image Translation (using crop) with Pillow:

from PIL import Image
def translate_image(image_path, output_path, tx, ty):
    image = Image.open(image_path)
    translated_image = image.crop((tx, ty, image.width, image.height))
    translated_image.save(output_path)
# Example usage:
translate_image('clcodingmr.jpg', 'translated_output.jpg', 50, 30)
Image.open('translated_output.jpg')




4. Image Shearing (using affine transform) with Pillow:
Image.open('sheared_output.jpg')
from PIL import Image, ImageOps
def shear_image(image_path, output_path, shear_factor):
    image = Image.open(image_path)
    shear_matrix = [1, shear_factor, 0, 0, 1, 0]
    sheared_image = image.transform(image.size, Image.AFFINE, shear_matrix)
    sheared_image.save(output_path)
# Example usage:
shear_image('clcodingmr.jpg', 'sheared_output.jpg', 0.2)
Image.open('sheared_output.jpg')




5. Image Normalization (simple contrast adjustment) with Pillow:

from PIL import Image
def normalize_image(image_path, output_path):
    image = Image.open(image_path)
    normalized_image = ImageOps.autocontrast(image)
    normalized_image.save(output_path)
# Example usage:
normalize_image('clcodingmr.jpg', 'normalized_output.jpg')
Image.open('normalized_output.jpg')




6. Image Blurring (using a filter) with Pillow:

from PIL import Image, ImageFilter
def blur_image(image_path, output_path, radius):
    image = Image.open(image_path)
    blurred_image = image.filter(ImageFilter.GaussianBlur(radius))
    blurred_image.save(output_path)
# Example usage:
blur_image('clcodingmr.jpg', 'blurred_output.jpg', 5)
Image.open('blurred_output.jpg')




Google Project Management: Professional Certificate

 


What you'll learn

Gain an immersive understanding of the practices and skills needed to succeed in an entry-level project management role

Learn how to create effective project documentation and artifacts throughout the various phases of a project

Learn the foundations of Agile project management, with a focus on implementing Scrum events, building Scrum artifacts, and understanding Scrum roles

Practice strategic communication, problem-solving, and stakeholder management through real-world scenarios

Join Free: 

Professional Certificate - 6 course series

Prepare for a new career in the high-growth field of project management, no experience required. Get professional training designed by Google and get on the fastrack to a competitively paid job.

Project managers are natural problem-solvers. They set the plan and guide teammates, and manage changes, risks, and stakeholders.

Over 6 courses, gain in-demand skills that will prepare you for an entry-level job. Learn from Google employees whose foundations in project management served as launchpads for their own careers. At under 10 hours per week, you can complete in less than six months.

This program qualifies you for over 100 hours of project management education, which helps prepare you for 
Project Management Institute
 Certifications like the globally-recognized 
Certified Associate in Project Management (CAPM)®

Join FREE : Google Project Management: Professional Certificate


Applied Learning Project

This program includes over 140 hours of instruction and hundreds of practice-based assessments which will help you simulate real-world project management scenarios that are critical for success in the workplace.

The content is highly interactive and exclusively developed by Google employees with decades of experience in program and project management.

Skills you’ll gain will include: Creating risk management plans; Understanding process improvement techniques; Managing escalations, team dynamics, and stakeholders; Creating budgets and navigating procurement; Utilizing  project management software, tools, and templates; Practicing Agile project management, with an emphasis on Scrum.

Through a mix of videos, assessments, and hands-on activities, you’ll get introduced to initiating, planning, and running both traditional and Agile projects. You’ll develop a toolbox to demonstrate your understanding of key project management elements, including managing a schedule, budget, and team.

10 different data charts using Python

 # 10 different data charts using Python


pip install matplotlib seaborn

# 1. Line Chart:

import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y = [10, 12, 5, 8, 3]

plt.plot(x, y)
plt.title('Line Chart')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()
#clcoding.com




# 2. Bar Chart:

import matplotlib.pyplot as plt

categories = ['A', 'B', 'C', 'D']
values = [25, 40, 30, 20]

plt.bar(categories, values)
plt.title('Bar Chart')
plt.xlabel('Categories')
plt.ylabel('Values')
plt.show()
#clcoding.com




# 3. Pie Chart:

import matplotlib.pyplot as plt

labels = ['Category A', 'Category B', 'Category C']
sizes = [30, 45, 25]

plt.pie(sizes, labels=labels, autopct='%1.1f%%')
plt.title('Pie Chart')
plt.show()
#clcoding.com




# 4. Histogram:

import matplotlib.pyplot as plt
import numpy as np

data = np.random.randn(1000)

plt.hist(data, bins=30, edgecolor='black')
plt.title('Histogram')
plt.xlabel('Values')
plt.ylabel('Frequency')
plt.show()
#clcoding.com




# 5. Scatter Plot:

import matplotlib.pyplot as plt
import numpy as np

x = np.random.rand(50)
y = 2 * x + 1 + 0.1 * np.random.randn(50)

plt.scatter(x, y)
plt.title('Scatter Plot')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()
#clcoding.com




# 6. Box Plot:

import seaborn as sns
import numpy as np

data = [np.random.normal(0, std, 100) for std in range(1, 4)]

sns.boxplot(data=data)
plt.title('Box Plot')
plt.xlabel('Category')
plt.ylabel('Values')
plt.show()
#clcoding.com




# 7. Violin Plot:

import seaborn as sns
import numpy as np

data = [np.random.normal(0, std, 100) for std in range(1, 4)]

sns.violinplot(data=data)
plt.title('Violin Plot')
plt.xlabel('Category')
plt.ylabel('Values')
plt.show()
#clcoding.com




# 8. Heatmap:

import seaborn as sns
import numpy as np

data = np.random.rand(10, 10)

sns.heatmap(data, annot=True)
plt.title('Heatmap')
plt.show()
#clcoding.com




# 9. Area Chart:

import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y1 = [10, 15, 25, 30, 35]
y2 = [5, 10, 20, 25, 30]

plt.fill_between(x, y1, y2, color='skyblue', alpha=0.4)
plt.title('Area Chart')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()
#clcoding.com




# 10. Radar Chart:

import matplotlib.pyplot as plt
import numpy as np

labels = np.array([' A', ' B', ' C', ' D', ' E'])
data = np.array([4, 5, 3, 4, 2])

angles = np.linspace(0, 2 * np.pi, len(labels), endpoint=False)
data = np.concatenate((data, [data[0]]))
angles = np.concatenate((angles, [angles[0]]))

plt.polar(angles, data, marker='o')
plt.fill(angles, data, alpha=0.25)
plt.title('Radar Chart')
plt.show()
#clcoding.com




Popular Posts

Categories

AI (27) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (118) C (77) C# (12) C++ (82) Course (62) Coursera (180) Cybersecurity (22) data management (11) Data Science (96) Data Strucures (6) Deep Learning (9) Django (6) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flutter (1) FPL (17) Google (19) Hadoop (3) HTML&CSS (46) IBM (25) IoT (1) IS (25) Java (92) Leet Code (4) Machine Learning (44) Meta (18) MICHIGAN (5) microsoft (4) Pandas (3) PHP (20) Projects (29) Python (757) Python Coding Challenge (238) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (40) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses