Python 3 Data Visualization Using ChatGPT / GPT-4

Python 3 Data Visualization Using ChatGPT / GPT-4

Python 3 Data Visualization Using ChatGPT / GPT-4
Автор: Campesato Oswald
Дата выхода: 2024
Издательство: Mercury Learning and Information LLC.
Количество страниц: 314
Размер файла: 2.5 MB
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы

Cover....1

Title Page....4

Copyright Page....5

Dedication....6

Contents....8

Preface....16

Chapter 1: Introduction to Python....20

Tools for Python....20

easy_install and pip....20

virtualenv....21

IPython....21

Python Installation....22

Setting the PATH Environment Variable (Windows Only)....22

Launching Python on Your Machine....22

The Python Interactive Interpreter....23

Python Identifiers....23

Lines, Indentation, and Multi-Line Comments....24

Quotations and Comments in Python....25

Saving Your Code in a Module....26

Some Standard Modules in Python....27

The help() and dir() Functions....27

Compile Time and Runtime Code Checking....28

Simple Data Types....29

Working with Numbers....29

Working with Other Bases....30

The chr() Function....31

The round() Function....31

Formatting Numbers....32

Working with Fractions....32

Unicode and UTF-8....33

Working with Unicode....33

Working with Strings....34

Comparing Strings....35

Formatting Strings....36

Slicing and Splicing Strings....36

Testing for Digits and Alphabetic Characters....37

Search and Replace a String in Other Strings....38

Remove Leading and Trailing Characters....39

Printing Text without NewLine Characters....40

Text Alignment....41

Working with Dates....41

Converting Strings to Dates....42

Exception Handling in Python....43

Handling User Input....44

Command-Line Arguments....46

Summary....47

Chapter 2: Introduction to NumPy....48

What is NumPy?....48

Useful NumPy Features....49

What are NumPy Arrays?....49

Working with Loops....50

Appending Elements to Arrays (1)....51

Appending Elements to Arrays (2)....51

Multiplying Lists and Arrays....52

Doubling the Elements in a List....53

Lists and Exponents....53

Arrays and Exponents....54

Math Operations and Arrays....54

Working with “–1” Subranges with Vectors....55

Working with “–1” Subranges with Arrays....55

Other Useful NumPy Methods....56

Arrays and Vector Operations....57

NumPy and Dot Products (1)....57

NumPy and Dot Products (2)....58

NumPy and the Length of Vectors....59

NumPy and Other Operations....60

NumPy and the reshape() Method....60

Calculating the Mean and Standard Deviation....61

Code Sample with Mean and Standard Deviation....62

Trimmed Mean and Weighted Mean....63

Working with Lines in the Plane (Optional)....64

Plotting Randomized Points with NumPy and Matplotlib....67

Plotting a Quadratic with NumPy and Matplotlib....68

What is Linear Regression?....69

What is Multivariate Analysis?....69

What about Non-Linear Datasets?....70

The MSE (Mean Squared Error) Formula....71

Other Error Types....71

Non-Linear Least Squares....72

Calculating the MSE Manually....72

Find the Best-Fitting Line in NumPy....73

Calculating the MSE by Successive Approximation (1)....74

Calculating the MSE by Successive Approximation (2)....77

Google Colaboratory....79

Uploading CSV Files in Google Colaboratory....80

Summary....81

Chapter 3: Pandas and Data Visualization....82

What Is Pandas?....82

Pandas DataFrames....83

Dataframes and Data Cleaning Tasks....83

A Pandas DataFrame Example....83

Describing a Pandas DataFrame....85

Pandas Boolean DataFrames....87

Transposing a Pandas DataFrame....88

Pandas DataFrames and Random Numbers....89

Converting Categorical Data to Numeric Data....90

Matching and Splitting Strings in Pandas....94

Merging and Splitting Columns in Pandas....96

Combining Pandas DataFrames....98

Data Manipulation With Pandas DataFrames....99

Data Manipulation With Pandas DataFrames (2)....100

Data Manipulation With Pandas DataFrames (3)....101

Pandas DataFrames and CSV Files....102

Pandas DataFrames and Excel Spreadsheets....105

Select, Add, and Delete Columns in DataFrames....106

Handling Outliers in Pandas....108

Pandas DataFrames and Scatterplots....109

Pandas DataFrames and Simple Statistics....110

Finding Duplicate Rows in Pandas....111

Finding Missing Values in Pandas....114

Sorting DataFrames in Pandas....116

Working With groupby() in Pandas....117

Aggregate Operations With the titanic.csv Dataset....119

Working with apply() and mapapply() in Pandas....121

Useful One-Line Commands in Pandas....124

What is Texthero?....126

Data Visualization in Pandas....126

Summary....128

Chapter 4: Pandas and SQL....130

Pandas and Data Visualization....130

Pandas and Bar Charts....131

Pandas and Horizontally Stacked Bar Charts....132

Pandas and Vertically Stacked Bar Charts....133

Pandas and Nonstacked Area Charts....135

Pandas and Stacked Area Charts....136

What Is Fugue?....138

MySQL, SQLAlchemy, and Pandas....139

What Is SQLAlchemy?....139

Read MySQL Data via SQLAlchemy....139

Export SQL Data From Pandas to Excel....141

MySQL and Connector/Python....142

Establishing a Database Connection....143

Reading Data From a Database Table....143

Creating a Database Table....144

Writing Pandas Data to a MySQL Table....145

Read XML Data in Pandas....147

Read JSON Data in Pandas....148

Working WithJSON-Based Data....150

Python Dictionary and JSON....150

Python, Pandas, and JSON....151

Pandas and Regular Expressions (Optional)....152

What Is SQLite?....155

SQLite Features....155

SQLite Installation....156

Create a Database and a Table....156

Insert, Select, and Delete Table Data....157

Launch SQL Files....157

Drop Tables and Databases....158

Load CSV Data Into a sqlite Table....159

Python and SQLite....160

Connect to a sqlite3 Database....160

Create a Table in a sqlite3 Database....160

Insert Data in a sqlite3 Table....160

Select Data From a sqlite3 Table....161

Populate a Pandas Dataframe From a sqlite3 Table....162

Histogram With Data From a sqlite3 Table (1)....162

Histogram With Data From a sqlite3 Table (2)....163

Working With sqlite3 Tools....164

SQLiteStudio Installation....165

DB Browser for SQLite Installation....166

SQLiteDict (Optional)....166

Working With Beautiful Soup....167

Parsing an HTML Web Page....168

Beautiful Soup and Pandas....170

Beautiful Soup and Live HTML Web Pages....172

Summary....173

Chapter 5: Matplotlib and Visualization....176

What is Data Visualization?....177

Types of Data Visualization....178

What is Matplotlib?....178

Matplotlib Styles....179

Display Attribute Values....180

Color Values in Matplotlib....181

Cubed Numbers in Matplotlib....182

Horizontal Lines in Matplotlib....182

Slanted Lines in Matplotlib....183

Parallel Slanted Lines in Matplotlib....184

A Grid of Points in Matplotlib....185

A Dotted Grid in Matplotlib....186

Two Lines and a Legend in Matplotlib....187

Loading Images in Matplotlib....188

A Checkerboard in Matplotlib....189

Randomized Data Points in Matplotlib....190

A Set of Line Segments in Matplotlib....191

Plotting Multiple Lines in Matplotlib....192

Trigonometric Functions in Matplotlib....193

A Histogram in Matplotlib....193

Histogram with Data from a sqlite3 Table....194

Plot Bar Charts in Matplotlib....196

Plot a Pie Chart in Matplotlib....197

Heat Maps in Matplotlib....198

Save Plot as a PNG File....199

Working with SweetViz....200

Working with Skimpy....201

3D Charts in Matplotlib....202

Plotting Financial Data with MPLFINANCE....203

Charts and Graphs with Data from Sqlite3....204

Summary....206

Chapter 6: Seaborn for Data Visualization....208

Working With Seaborn....208

Features of Seaborn....209

Seaborn Dataset Names....209

Seaborn Built-In Datasets....210

The Iris Dataset in Seaborn....211

The Titanic Dataset in Seaborn....212

Extracting Data From Titanic Dataset in Seaborn (1)....212

Extracting Data From Titanic Dataset in Seaborn (2)....215

Visualizing a Pandas Dataset in Seaborn....217

Seaborn Heat Maps....218

Seaborn Pair Plots....220

What Is Bokeh?....222

Introduction to Scikit-Learn....224

The Digits Dataset in Scikit-learn....225

The Iris Dataset in Scikit-Learn....228

Scikit-Learn, Pandas, and the Iris Dataset....230

Advanced Topics in Seaborn....232

Summary....234

Chapter 7: ChatGPT and GPT-4....236

What is Generative AI?....236

Important Features of Generative AI....237

Popular Techniques in Generative AI....237

What Makes Generative AI Unique....237

Conversational AI Versus Generative AI....238

Primary Objective....238

Applications....238

Technologies Used....239

Training and Interaction....239

Evaluation....239

Data Requirements....239

Is DALL-E Part of Generative AI?....239

Are ChatGPT-3 and GPT-4 Part of Generative AI?....240

DeepMind....241

DeepMind and Games....241

Player of Games (PoG)....242

OpenAI....242

Cohere....243

Hugging Face....243

Hugging Face Libraries....243

Hugging Face Model Hub....244

AI21....244

InflectionAI....244

Anthropic....245

What is Prompt Engineering?....245

Prompts and Completions....246

Types of Prompts....246

Instruction Prompts....247

Reverse Prompts....247

System Prompts Versus Agent Prompts....247

Prompt Templates....248

Prompts for Different LLMs....249

Poorly Worded Prompts....250

What is ChatGPT?....251

ChatGPT: GPT-3 “on Steroids”?....251

ChatGPT: Google “Code Red”....252

ChatGPT Versus Google Search....252

ChatGPT Custom Instructions....253

ChatGPT on Mobile Devices and Browsers....253

ChatGPT and Prompts....254

GPTBot....254

ChatGPT Playground....255

Plugins, Code Interpreter, and Code Whisperer....255

Plugins....255

Advanced Data Analysis....256

Advanced Data Analysis Versus Claude-2....257

Code Whisperer....257

Detecting Generated Text....258

Concerns About ChatGPT....259

Code Generation and Dangerous Topics....259

ChatGPT Strengths and Weaknesses....260

Sample Queries and Responses from ChatGPT....260

Chatgpt and Medical Diagnosis....262

Alternatives to ChatGPT....263

Google Bard....263

YouChat....264

Pi From Inflection....264

Machine Learning and Chatgpt....264

What is InstructGPT?....265

VizGPT and Data Visualization....266

What is GPT-4?....267

GPT-4 and Test Scores....267

GPT-4 Parameters....268

GPT-4 Fine-Tuning....268

ChatGPT and GPT-4 Competitors....269

Bard....269

CoPilot (OpenAI/Microsoft)....270

Codex (OpenAI)....270

Apple GPT....271

PaLM-2....271

Med-PaLM M....271

Claude-2....271

Llama-2....272

How to Download Llama-2....272

Llama-2 Architecture Features....273

Fine-Tuning Llama-2....273

When Will GPT-5 Be Available?....274

Summary....274

Chapter 8: ChatGPT and Data Visualization....276

Working with Charts and Graphs....277

Bar Charts....277

Pie Charts....277

Line Graphs....278

Heat Maps....278

Histograms....279

Box Plots....279

Pareto Charts....279

Radar Charts....280

Treemaps....280

Waterfall Charts....280

Line Plots with Matplotlib....281

A Pie Chart Using Matplotlib....282

Box and Whisker Plots Using Matplotlib....283

Time Series Visualization with Matplotlib....284

Stacked Bar Charts with Matplotlib....285

Donut Charts Using Matplotlib....286

3D Surface Plots with Matplotlib....287

Radial or Spider Charts with Matplotlib....288

Matplotlib’s Contour Plots....290

Stream Plots for Vector Fields....291

Quiver Plots for Vector Fields....293

Polar Plots....294

Bar Charts with Seaborn....295

Scatterplots with a Regression Line Using Seaborn....296

Heat Maps for Correlation Matrices with Seaborn....297

Histograms with Seaborn....298

Violin Plots with Seaborn....299

Pair Plots Using Seaborn....300

Facet Grids with Seaborn....301

Hierarchical Clustering....302

Swarm Plots....303

Joint Plot for Bivariate Data....304

Point Plots for Factorized Views....305

Seaborn’s KDE Plots for Density Estimations....306

Seaborn’s Ridge Plots....307

Summary....308

Index....310

This book is designed to show readers the concepts ofPython 3 programming and the art of data visualization. It also explores cutting-edge techniques using ChatGPT/GPT-4 in harmony with Python for generating visuals that tell more compelling data stories. Chapter 1 introduces the essentials of Python, covering a vast array of topics from basic data types, loops, and functions to more advanced constructs like dictionaries, sets, and matrices. In Chapter 2, the focus shifts to NumPy and its powerful array operations, leading into data visualization using prominent libraries such as Matplotlib. Chapter 6 includes Seaborn's rich visualization tools, offering insights into datasets like Iris and Titanic. Further, the book covers other visualization tools and techniques, including SVG graphics, D3 for dynamic visualizations, and more. Chapter 7 covers information about the main features of ChatGPT and GPT-4, as well as some of their competitors. Chapter 8 contains examples of using ChatGPT in order to perform data visualization, such as charts and graphs that are based on datasets (e.g., the Titanic dataset). Companion files with code, datasets, and figures are available for downloading with Amazon proof of purchase by writing to info@merclearning.com. From foundational Python concepts to the intricacies of data visualization, this book is ideal for Python practitioners, data scientists, and anyone in the field of data analytics looking to enhance their storytelling with data through visuals. It's also perfect for educators seeking material for teaching advanced data visualization techniques.

FEATURES

  • Explores cutting-edge techniques using ChatGPT/GPT-4 in harmony with Python for generating visuals that tell more compelling data stories
  • Contains detailed tutorials that guide you through the creation of complex visuals
  • Tackles actual data scenarios and builds your expertise as you apply learned concepts to real datasets
  • Features data manipulation and cleaning with Pandas to prepare flawless datasets ready for visualization
  • Includes companion files with source code, data sets, and figures(available for downloading with Amazon proof of purchase by writing to info@merclearning.com)

Похожее:

Список отзывов:

Нет отзывов к книге.