Learn to master basic programming tasks from scratch with real-life, scientifically relevant examples and solutions drawn from both science and engineering. Students and researchers at all levels are increasingly turning to the powerful Python programming language as an alternative to commercial packages and this fast-paced introduction moves from the basics to advanced concepts in one complete volume, enabling readers to gain proficiency quickly. Beginning with general programming concepts such as loops and functions within the core Python 3 language, and moving on to the NumPy, SciPy and Matplotlib libraries for numerical programming and data visualization, this textbook also discusses the use of Jupyter Notebooks to build rich-media, shareable documents for scientific analysis. The second edition features a new chapter on data analysis with the pandas library and comprehensive updates, and new exercises and examples. A final chapter introduces more advanced topics such as floating-point precision and algorithm stability, and extensive online resources support further study. This textbook represents a targeted package for students requiring a solid foundation in Python programming.
Author(s): Christian Hill
Edition: 2
Publisher: Cambridge University Press
Year: 2020
Language: English
Commentary: Vector PDF
Pages: 568
City: Cambridge, UK
Tags: Data Analysis; Programming; Python; Ordinary Differential Equations; Data Visualization; NumPy; matplotlib; pandas; Jupyter; SciPy; iPython; Elementary
Copyright
Contents
Acknowledgments
Code Listings
1 Introduction
1.1 About This Book
1.2 About Python
1.3 Installing Python
1.4 The Command Line
2 The Core Python Language I
2.1 The Python Shell
2.2 Numbers, Variables, Comparisons and Logic
2.3 Python Objects I: Strings
2.4 Python Objects II: Lists, Tuples and Loops
2.5 Control Flow
2.6 File Input/Output
2.7 Functions
3 Interlude: Simple Plots and Charts
3.1 Basic Plotting
3.2 Labels, Legends and Customization
3.3 More Advanced Plotting
4 The Core Python Language II
4.1 Errors and Exceptions
4.2 Python Objects III: Dictionaries and Sets
4.3 Pythonic Idioms: “Syntactic Sugar”
4.4 Operating-System Services
4.5 Modules and Packages
4.6 An Introduction to Object-Oriented Programming
5 IPython and Jupyter Notebook
5.1 IPython
5.2 Jupyter Notebook
6 NumPy
6.1 Basic Array Methods
6.2 Reading and Writing an Array to a File
6.3 Statistical Methods
6.4 Polynomials
6.5 Linear Algebra
6.6 Random Sampling
6.7 Discrete Fourier Transforms
7 Matplotlib
7.1 Line Plots and Scatter Plots
7.2 Plot Customization and Refinement
7.3 Bar Charts, Pie Charts and Polar Plots
7.4 Annotating Plots
7.5 Contour Plots and Heatmaps
7.6 Three-Dimensional Plots
7.7 Animation
8 SciPy
8.1 Physical Constants and Special Functions
8.2 Integration and Ordinary Differential Equations
8.3 Interpolation
8.4 Optimization, Data-Fitting and Root-Finding
9 Data Analysis with pandas
9.1 Introduction to pandas
9.2 Reading and Writing Series and DataFrames
9.3 More Advanced Indexing
9.4 Data Cleaning and Exploration
9.5 Data Grouping and Aggregation
9.6 Examples
10 General Scientific Programming
10.1 Floating-Point Arithmetic
10.2 Stability and Conditioning
10.3 Programming Techniques and Software Development
Appendix A Solutions
Appendix B Differences Between Python Versions 2 and 3
Appendix C SciPy’s odeint Ordinary Differential Equation Solver
Glossary
Index