BiteSize Python for Intermediate Learners with practice labs, real-world examples, and cenerative ai assistance
This book is an introduction to Python for intermediate learners. It allows readers to take a slow and steady approach to building upon their understanding of Python code. While there are many books, websites, and online courses about the topic, Python programming is broken down here into easily digestible lessons of less than 5 minutes each, following a tried and tested BiteSize approach.
Each lesson begins with a clear and concise introduction to the topic, giving the reader a strong base to start from and gets them ready for deeper learning. This is followed by coding demonstrations that further explore the ideas discussed. The book offers practice tasks in different difficulty levels, so readers can test their knowledge and grow their confidence. The reader will also play with case studies to solve real-world problems. Tips on how to incorporate Generative AI into a learning toolkit are provided, for purposes like feedback, practice exercises, code reviews, and exploring advanced topics. Recommended AI prompts can help readers identify areas for improvement, review key concepts, and track progress.
This book is designed for intermediate learners with a basic understanding of Python. It is ideal for individuals with busy schedules or limited time for studying.
Cover Page....2
Half-Title Page....3
Series Page....4
Title Page....6
Copyright Page....8
Dedication Page....10
Contents....11
List of Figures....25
List of Tables....36
Foreword....37
Preface....39
Author Biographies....44
Section I Object-Oriented Programming....45
Chapter 1 Introduction to OOP....48
1.1 The Idea....48
1.2 Create A Class....51
1.3 Four Aspects....62
1.4 Interact with Genai....63
Chapter 2 Inheritance....67
2.1 What is Inheritance?....67
2.2 Animal Class Revisit....71
2.3 Case Studies....74
2.4 Interact with Genai....81
Chapter 3 Polymorphism....84
3.1 What is Polymorphism....84
3.2 Family Tree Revisited....87
3.3 Animals Revisit....89
3.4 Vehicles Revisit....90
3.5 Case Studies....92
3.6 Interact With Genai....100
Chapter 4 Encapsulation....103
4.1 Introduction to Encapsulation....103
4.2 Bank Account....109
4.3 Student Grades....111
4.4 Car Engine....113
4.5 Case Studies....115
4.6 Interact With Genai....121
Chapter 5 Abstraction....124
5.1 Introduction to Abstraction....124
5.2 Vehicles....127
5.3 Payment....130
5.4 Case Studies....131
5.5 Interact with Genai....136
Chapter 6 Documentation....138
6.1 Introduction....138
6.2 Book....142
6.3 Interact with Genai....145
Chapter 7 Case Studies....148
7.1 Iphone....148
7.2 Employee....153
7.3 University System....159
7.4 Vehicle Rental System....164
7.5 Online Marketplace....169
Section II Data Manipulation....179
Chapter 8 N-dimensional Arrays....182
8.1 What is A N-Dimensional Array....182
8.2 Lesson: Compare Ndarray with List....183
8.3 Performance Comparison....185
8.4 Lesson: Ndarray Creation....189
8.5 Lesson: Access 1D Ndarray....200
8.6 Lesson: Access 2D Ndarray....204
8.7 Lesson: Ndarray Manipulation....209
8.8 Lesson: Operations in Ndarray....219
8.9 Interact with Genai....225
8.10 Explore more of Ndarray....226
Chapter 9 NumPy....228
9.1 Universal Functions....228
9.2 Statistical Methods....235
9.3 Linear Algebra....240
9.4 Random Generation....247
9.5 Masking....252
9.6 Interact with Genai....260
9.7 Explore more Numpy....261
Chapter 10 Series....263
10.1 What is A Series....264
10.2 Create A Series....264
10.3 Accessing A Series....271
10.4 Math Operations....281
10.5 Interact with Genai....294
10.6 Explore more of Series....295
Chapter 11 DataFrame....297
11.1 What is A Dataframe....297
11.2 Create A Dataframe....299
11.3 Access Elements in A Dataframe Using Labels....307
11.4 Access Elements in A Dataframe using Indices....313
11.5 Manipulate Rows in A Dataframe....318
11.6 Manipulate Columns in A Dataframe....324
11.7 Merging Dataframes....330
11.8 Concatenating Dataframes....336
11.9 Interact with Genai....345
11.10 Explore more of Dataframe....346
Chapter 12 Pandas....348
12.1 What is Pandas....348
12.2 Useful Functionalities....349
12.3 Descriptive Statistics for Numerical Columns....356
12.4 Descriptive Statistics for Categorical Columns....365
12.5 Lesson: Groupby() and Aggregation....369
12.6 Handling Missing Data....376
12.7 Handling Duplicate Values....382
12.8 Interact with Genai....391
12.9 Explore more of Pandas....392
Section III Data Visualization....393
Chapter 13 Matplotlib (Basic)....396
13.1 Introduction....396
13.2 A Simple Plot....397
13.3 Titles and Labels....401
13.4 Legend....406
13.5 Customization....410
13.6 Annotation....415
13.7 Subplots....416
13.8 Interact with Genai....420
Chapter 14 Matplotlib (Advanced)....423
14.1 Introduction....423
14.2 Line Plot....424
14.3 Bar Plot....426
14.4 Histogram....430
14.5 Scatter Plot....433
14.6 Pie Chart....436
14.7 Box Plot....440
14.8 Heatmap....443
14.9 Subplots Again....447
14.10 Interact with Genai....455
14.11 Explore more of Matplotlib....455
Chapter 15 Seaborn....458
15.1 Introduction....458
15.2 Relational Plots....461
15.3 Distribution Plots....471
15.4 Categorical Plots....487
15.5 Adding Colors....507
15.6 More Styles....532
15.7 Facet Grids....540
15.8 Lesson: Lmplot....548
15.9 Multiple Plots....560
15.10 Interact with Genai....567
15.11 Explore more Seaborn....568
Chapter 16 Plotly....571
16.1 Overview....571
16.2 Setup....573
16.3 Scatter Plots....574
16.4 Line Plots....585
16.5 Area Plots....596
16.6 Bar Plots....604
16.7 Timeline Plots....615
16.8 Funnel Plots....623
16.9 Pie Plots....630
16.10 Histogram Plots....638
16.11 3D Scatter Plots....647
16.12 3D Line Plots....652
16.13 Interact with Genai....656
16.14 Explore more About Plotly....657
What is Next?....658
Index....659