29,99 €
This book teaches Python 3 programming and data visualization, exploring cutting-edge techniques with ChatGPT/GPT-4 for generating compelling visuals. It starts with Python essentials, covering basic data types, loops, functions, and advanced constructs like dictionaries and matrices. The journey progresses to NumPy's array operations and data visualization using libraries such as Matplotlib and Seaborn. The book also covers tools like SVG graphics and D3 for dynamic visualizations.
The course begins with foundational Python concepts, moves into NumPy and data visualization with Pandas, Matplotlib, and Seaborn. Advanced chapters explore ChatGPT and GPT-4, demonstrating their use in creating data visualizations from datasets like the Titanic. Each chapter builds on the previous one, ensuring a comprehensive understanding of Python and visualization techniques.
These concepts are crucial for Python practitioners, data scientists, and anyone in data analytics. This book transitions readers from basic Python programming to advanced data visualization, blending theoretical knowledge with practical skills. Companion files with code, datasets, and figures enhance learning, making this an essential resource for mastering Python and data visualization.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 223
Veröffentlichungsjahr: 2024
LICENSE, DISCLAIMER OF LIABILITY, AND LIMITED WARRANTY
By purchasing or using this book and companion files (the “Work”), you agree that this license grants permission to use the contents contained herein, including the disc, but does not give you the right of ownership to any of the textual content in the book / disc or ownership to any of the information or products contained in it. This license does not permit uploading of the Work onto the Internet or on a network (of any kind) without the written consent of the Publisher. Duplication or dissemination of any text, code, simulations, images, etc. contained herein is limited to and subject to licensing terms for the respective products, and permission must be obtained from the Publisher or the owner of the content, etc., in order to reproduce or network any portion of the textual material (in any media) that is contained in the Work.
MERCURY LEARNING AND INFORMATION (“MLI” or “the Publisher”) and anyone involved in the creation, writing, or production of the companion disc, accompanying algorithms, code, or computer programs (“the software”), and any accompanying Web site or software of the Work, cannot and do not warrant the performance or results that might be obtained by using the contents of the Work. The author, developers, and the Publisher have used their best efforts to ensure the accuracy and functionality of the textual material and/or programs contained in this package; we, however, make no warranty of any kind, express or implied, regarding the performance of these contents or programs. The Work is sold “as is” without warranty (except for defective materials used in manufacturing the book or due to faulty workmanship).
The author, developers, and the publisher of any accompanying content, and anyone involved in the composition, production, and manufacturing of this work will not be liable for damages of any kind arising out of the use of (or the inability to use) the algorithms, source code, computer programs, or textual material contained in this publication. This includes, but is not limited to, loss of revenue or profit, or other incidental, physical, or consequential damages arising out of the use of this Work.
The sole remedy in the event of a claim of any kind is expressly limited to replacement of the book and/or disc, and only at the discretion of the Publisher. The use of “implied warranty” and certain “exclusions” varies from state to state and might not apply to the purchaser of this product.
Companion files for this title are available by writing to the publisher at info@merclearning.com.
Oswald Campesato
MERCURY LEARNING AND INFORMATION
Boston, Massachusetts
Copyright ©2024 by MERCURY LEARNING AND INFORMATION.An Imprint of DeGruyter Inc. All rights reserved.
This publication, portions of it, or any accompanying software may not be reproduced in any way, stored in a retrieval system of any type, or transmitted by any means, media, electronic display or mechanical display, including, but not limited to, photocopy, recording, Internet postings, or scanning, without prior permission in writing from the publisher.
Publisher: David Pallai
MERCURY LEARNING AND INFORMATION
121 High Street, 3rd Floor
Boston, MA 02110
info@merclearning.com
www.merclearning.com
800-232-0223
O. Campesato. Python 3 Data Visualization Using Google Gemini.
ISBN: 978-1-50152-280-2
The publisher recognizes and respects all marks used by companies, manufacturers, and developers as a means to distinguish their products. All brand names and product names mentioned in this book are trademarks or service marks of their respective companies. Any omission or misuse (of any kind) of service marks or trademarks, etc. is not an attempt to infringe on the property of others.
Library of Congress Control Number: 2024932122
242526321 This book is printed on acid-free paper in the United States of America.
Our titles are available for adoption, license, or bulk purchase by institutions, corporations, etc. For additional information, please contact the Customer Service Dept. at 800-232-0223 (toll free).
All of our titles are available in digital format at academiccourseware.com and other digital vendors. Companion files (figures and code listings) for this title are available by contacting info@merclearning.com. The sole obligation of MERCURY LEARNING AND INFORMATION to the purchaser is to replace the files, based on defective materials or faulty workmanship, but not based on the operation or functionality of the product.
I’d like to dedicate this book to my parents– may this bring joy and happiness into their lives.
Preface
Chapter 1: Introduction to Python
Tools for Python
easy_install and pip
virtualenv
IPython
Python Installation
Setting the PATH Environment Variable (Windows Only)
Launching Python on Your Machine
The Python Interactive Interpreter
Python Identifiers
Lines, Indentation, and Multi-Line Comments
Quotations and Comments in Python
Saving Your Code in a Module
Some Standard Modules in Python
The help() and dir() Functions
Compile Time and Runtime Code Checking
Simple Data Types
Working with Numbers
Working with Other Bases
The chr() Function
The round() Function
Formatting Numbers
Working with Fractions
Unicode and UTF-8
Working with Unicode
Working with Strings
Comparing Strings
Formatting Strings
Slicing and Splicing Strings
Testing for Digits and Alphabetic Characters
Search and Replace a String in Other Strings
Remove Leading and Trailing Characters
Printing Text Without NewLine Characters
Text Alignment
Working with Dates
Converting Strings to Dates
Exception Handling in Python
Handling User Input
Command-Line Arguments
Summary
Chapter 2: Introduction to NumPy
What is NumPy?
Useful NumPy Features
What are NumPy Arrays?
Working with Loops
Appending Elements to Arrays (1)
Appending Elements to Arrays (2)
Multiplying Lists and Arrays
Doubling the Elements in a List
Lists and Exponents
Arrays and Exponents
Math Operations and Arrays
Working with “–1” Subranges with Vectors
Working with “–1” Subranges with Arrays
Other Useful NumPy Methods
Arrays and Vector Operations
NumPy and Dot Products (1)
NumPy and Dot Products (2)
NumPy and the Length of Vectors
NumPy and Other Operations
NumPy and the reshape() Method
Calculating the Mean and Standard Deviation
Code Sample with Mean and Standard Deviation
Trimmed Mean and Weighted Mean
Working with Lines in the Plane (Optional)
Plotting Randomized Points with NumPy and Matplotlib
Plotting a Quadratic with NumPy and Matplotlib
What is Linear Regression?
What is Multivariate Analysis?
What about Non-Linear Datasets?
The MSE (Mean Squared Error) Formula
Other Error Types
Non-Linear Least Squares
Calculating the MSE Manually
Find the Best-Fitting Line in NumPy
Calculating the MSE by Successive Approximation (1)
Calculating the MSE by Successive Approximation (2)
Google Colaboratory
Uploading CSV Files in Google Colaboratory
Summary
Chapter 3: Matplotlib and Visualization
What is Data Visualization?
Types of Data Visualization
What is Matplotlib?
Matplotlib Styles
Display Attribute Values
Color Values in Matplotlib
Cubed Numbers in Matplotlib
Horizontal Lines in Matplotlib
Slanted Lines in Matplotlib
Parallel Slanted Lines in Matplotlib
A Grid of Points in Matplotlib
A Dotted Grid in Matplotlib
Two Lines and a Legend in Matplotlib
Loading Images in Matplotlib
A Checkerboard in Matplotlib
Randomized Data Points in Matplotlib
A Set of Line Segments in Matplotlib
Plotting Multiple Lines in Matplotlib
Trigonometric Functions in Matplotlib
A Histogram in Matplotlib
Histogram with Data from a sqlite3 Table
Plot Bar Charts in Matplotlib
Plot a Pie Chart in Matplotlib
Heat Maps in Matplotlib
Save Plot as a PNG File
Working with SweetViz
Working with Skimpy
3D Charts in Matplotlib
Plotting Financial Data with Mplfinance
Charts and Graphs with Data from Sqlite3
Summary
Chapter 4: Seaborn for Data Visualization
Working With Seaborn
Features of Seaborn
Seaborn Dataset Names
Seaborn Built-In Datasets
The Iris Dataset in Seaborn
The Titanic Dataset in Seaborn
Extracting Data From Titanic Dataset in Seaborn (1)
Extracting Data From Titanic Dataset in Seaborn (2)
Visualizing a Pandas Dataset in Seaborn
Seaborn Heat Maps
Seaborn Pair Plots
What Is Bokeh?
Introduction to Scikit-Learn
The Digits Dataset in Scikit-learn
The Iris Dataset in Scikit-Learn
Scikit-Learn, Pandas, and the Iris Dataset
Advanced Topics in Seaborn
Summary
Chapter 5: Generative AI, Bard, and Gemini
What is Generative AI?
Key Features of Generative AI
Popular Techniques in Generative AI
What Makes Generative AI Unique
Conversational AI Versus Generative AI
Primary Objective
Applications
Technologies Used
Training and Interaction
Evaluation
Data Requirements
Is Gemini Part of Generative AI?
DeepMind
DeepMind and Games
Player of Games (PoG)
OpenAI
Cohere
Hugging Face
Hugging Face Libraries
Hugging Face Model Hub
AI21
InflectionAI
Anthropic
What is Prompt Engineering?
Prompts and Completions
Types of Prompts
Instruction Prompts
Reverse Prompts
System Prompts Versus Agent Prompts
Prompt Templates
Poorly-Worded Prompts
What is Gemini?
Gemini Ultra Versus GPT-4
Gemini Strengths
Gemini’s Weaknesses
Gemini Nano on Mobile Devices
What is Bard?
Sample Queries and Responses from Bard
Alternatives to Bard
YouChat
Pi from Inflection
CoPilot (OpenAI/Microsoft)
Codex (OpenAI)
Apple GPT
Claude 2
Summary
Chapter 6: Bard and Data Visualization
Working With Charts and Graphs
Bar Charts
Pie Charts
Line Graphs
Heatmap
Histogram
Box Plot
Pareto Chart
Radar Chart
Treemap
Waterfall Chart
Line Plots With Matplotlib
A Pie Chart Using Matplotlib
Box and Whisker Plots Using Matplotlib
Stacked Bar Charts With Matplotlib
Donut Chart Using Matplotlib
3D Surface Plots With Matplotlib
Matplotlib’s Contour Plots
Streamplot for Vector Fields
Polar Plots
Bar Charts
Scatter Plot With Regression Line
Heatmap for Correlation Matrix With Seaborn
Histograms With Seaborn
Violin Plots With Seaborn
Summary
Index
This book offers a comprehensive guide to leveraging Python-based data visualization techniques with the innovative capabilities of Google Gemini. Tailored for individuals proficient in Python seeking to enhance their visualization skills, this book explores essential libraries like Pandas, Matplotlib, and Seaborn, along with insights into the innovative Gemini platform. With a focus on practicality and efficiency, it delivers a rapid yet thorough exploration of data visualization methodologies, supported by insightful Bard-generated code samples.
The first chapter contains a quick tour of basic Python 3, followed by a chapter that introduces you to NumPy. The third and fourth chapters introduce you to data visualization with Matplotlib and how to create graphics effects with Seaborn. The fifth chapter introduces you to Google Gemini, which also includes a discussion of GPT-4. The sixth and concluding chapter contains Gemini-generated Python code samples for performing various programming tasks.
Most of the code samples are short (usually less than one page and sometimes less than half a page), and if necessary, you can easily and quickly copy/paste the code into a new Jupyter notebook. For the Python code samples that reference a CSV file, you do not need any additional code in the corresponding Jupyter notebook to access the CSV file. Moreover, the code samples execute quickly, so you won’t need to avail yourself of the free GPU that is provided in Google Colaboratory.
If you do decide to use Google Colaboratory, you can easily copy/paste the Python code into a notebook, and also use the upload feature to upload existing Jupyter notebooks. Keep in mind the following point: if the Python code references a CSV file, make sure that you include the appropriate code snippet (details are available online) to access the CSV file in the corresponding Jupyter notebook in Google Colaboratory.
First, keep in mind that the Sklearn material in this book is minimalistic because this book is not about machine learning. Second, the Sklearn material is located in chapter 4 where you will learn about some of the Sklearn built-in datasets. If you decide to research machine learning, you will have already been introduced to some aspects of Sklearn.
Current knowledge of Python 3.x is the most helpful skill. Knowledge of other programming languages (such as Java) can also be helpful because of the exposure to programming concepts and constructs. The less technical knowledge that you have, the more diligence will be required in order to understand the assorted topics that are covered.
As for the non-technical skills, it is important to have a strong desire to learn about data visualization, along with the motivation and discipline to read and understand code samples.
The primary purpose of the code samples in this book is to show you Python-based libraries for data visualization. Clarity has higher priority than writing more compact code that is more difficult to understand (and more prone to bugs). If you decide to use any of the code in this book on a production website, you ought to subject that code to the same rigorous analysis as the other parts of your code base.
If you are a Mac user, there are three ways to do so. The first method is to use Finder to navigate to Applications > Utilities and then double click on the Utilities application. Next, if you already have a command shell available, you can launch a new command shell by typing the following command:
open /Applications/Utilities/Terminal.app
A second method for Mac users is to open a new command shell on a MacBook from a command shell that is already visible simply by clicking command+n in that command shell, and your Mac will launch another command shell.
If you are a PC user, you can install Cygwin (open source https://cygwin.com/) that simulates bash commands or use another toolkit such as MKS (a commercial product). Please read the online documentation that describes the download and installation process. Note that custom aliases are not automatically set if they are defined in a file other than the main start-up file (such as .bash_login).
All the code samples and figures in this book may be obtained by writing to the publisher at info@merclearning.com.
O. Campesato
February 2024
Tausende von E-Books und Hörbücher
Ihre Zahl wächst ständig und Sie haben eine Fixpreisgarantie.
Sie haben über uns geschrieben: