Python has a rich class library, which provides strong support for data science, machine learning, natural language processing and other fields, significantly reducing the work difficulty of AI developers.
This collection collects and collates some important Python class library learning resources, including NumPySciPy、Pandas、Matplotlib、Seaborn。I hope it will be helpful to everyone.
Points: 1Type: Technical documentUploader:HyperplatinumUpload time: May 30, 2021
Introduction: This book is a reference book for science, research and calculation and statistical methods focusing on data depth needs.This book has five chapters, each chapter introduces one or two key toolkits in Python data science.First, IPython and Jupyter provide the computing environment required by data scientists;Chapter 2 explains NumPy, which can provide an array object. It can store and operate large arrays efficiently in Python;Chapter 3 mainly deals with Pandas, which provides DataFrame objects. It can use Python to efficiently store and operate tagged/columnar data;The protagonist of Chapter 4 is Matplotlib, which provides Python with many data visualization functions;Chapter 5 focuses on Scikit Lean, which provides an efficient and clean Python implementation for the most important machine learning algorithm.This book is suitable for data science researchers with programming background who intend to use open source Python tools as data analysis, operation, visualization and learning.
Introduction: Author: Zhang RuoyuYear of publication: 2012This book introduces how to develop scientific computing applications in Python. In addition to numerical computing, it also focuses on how to make interactive 2D and 3D images, how to design sophisticated program interfaces, how to combine with high-speed computing programs written in C language, and how to write sound and image processing algorithms.The Python extension libraries involved in the book include NumPy, Scipy, SymPy, matplotlib, Traits, TraitsUI, Chaco, TVTK, Mayavi, VPython, OpenCV, etc. The application fields involved include numerical operation, symbol operation, two-dimensional chart, three-dimensional data visualization, three-dimensional animation demonstration, image processing, interface design, etc.In the book, a large number of examples are used to guide the readers to learn deeply step by step. Each example program has a detailed explanation and can run normally in the running environment recommended by the book.In addition, this book is attached with a large number of charts and illustrations to reduce the length of theoretical introduction and formula derivation, so that readers can learn and master theoretical knowledge through examples and data.
Points: 1Type: Technical documentUploader:HyperplatinumUpload time: May 30, 2021
Introduction: NumPy is an excellent scientific computing library, which provides many practical mathematical functions, powerful multidimensional array objects and excellent computing performance. It can not only replace many functions of Matlab and Mathematica, but also has become an important part of Python scientific computing ecosystem.But unlike these commercial products, it is free open source software.This book starts with the installation of NumPy, and gradually transitions to array objects, common functions, matrix operations, linear algebra, financial functions, window functions, quality control and other contents. It is dedicated to comprehensively explaining NumPy and its use to beginner and intermediate Python programmers.In addition, through the rich examples in the book, you will also learn Matplotlib drawing, and use other Python scientific computing libraries (such as Scipy and Scikits) in combination to make your work more effective and code more concise and efficient.Main contents:Install NumPy on different platforms;Use simple and efficient NumPy code to achieve high-performance computing;Use powerful general functions;Use NumPy arrays and matrices;The NumPy module can easily perform complex numerical calculations;Matplotlib drawing;NumPy code test.
Introduction: This book comprehensively introduces the relevant knowledge of Python data visualization in the form of combining theory with examples, using Anaconda 3 as the main development tool.The book is divided into nine chapters. Chapter 1 introduces the introduction to data visualization and matplotlib;Chapters 2 to 8 comprehensively introduce the core knowledge of matplotlib, including the use of matplotlib to draw simple charts, the customization of chart auxiliary elements, the beautification of chart styles, the drawing of sub charts and coordinate axis sharing, the customization of coordinate axes, the drawing of 3D charts and statistical maps, and the use of matplotlib to draw advanced charts;Chapter 9 introduces the basic knowledge of pyecharts.In addition to Chapter 1, other chapters are equipped with rich examples. Readers can practice while learning to consolidate their knowledge and improve their practical development ability in practice.This book can be used not only as a textbook for computer related majors in higher education and colleges, but also as an introductory book for data visualization technology enthusiasts.Chapter 1 Data visualization and matplotlib 0011.1 Data visualization overview 0021.1.1 What is data visualization 0021.1.2 Common data visualization methods 0031.1.3 Select the correct data visualization chart 0101.2 Common data visualization library 0121.3 Getting to know matplotlib 0131.3.1 Overview of matplotlib 0131.3.2 Install matplotlib 0141.4 Use matplotlib to draw diagram0171.5 Summary of this chapter 0191.6 Exercise 019Chapter 2 Use matplotlib to draw simpleChart 0212.1 Draw line chart 0222.1.1 Use plot() to draw a line chart 0222.1.2 Example 1: Mild weather in the next 15 yearsTemperature 0222.2 Draw Column Chart or Stacked Column Chart 0242.2.1 Use bar () to draw a column chart or stackColumn Chart 0242.2.2 Example 2: Ali in 2013-2019GMV 027 of Baba Taobao and Tmall platforms2.3 Draw Bar Chart or Stacked Bar Chart 0282.3.1 Use barh() to draw bar chart or stackBar Chart 0282.3.2 Example 3: Online shopping of various commodity typesSubstitution rate 0312.4 Draw Stacked Area Chart0332.4.1 Using stackplot() to Plot StacksArea Drawing 0332.4.2 Example 4: Logistics costs of logistics companiesStatistics 0342.5 Draw Histogram 0352.5.1 Use hist() to draw histograms 0352.5.2 Example 5: grayscale of face recognitionHistogram 0362.6 Draw pie chart or doughnut chart 0372.6.1 Use pie () to draw a pie chart orDoughnut 0372.6.2 Example 6: Paying Baoyue BillReport 0392.7 Draw Scatter Chart or Bubble Chart 0402.7.1 Use scatter() to draw a scatter plot orBubble 0402.7.2 Example 7: The relationship between vehicle speed and braking distanceRelationship 0412.8 Draw box diagram0422.8.1 Use boxplot () to draw boxplot 0422.8.2 Example 8: 2017 and 2018National Power Generation Statistics 0442.9 Draw radar map 0452.9.1 Draw radar map with polar() 0452.9.2 Example 9: Holland's professional interestTest 0452.10 Draw error bar diagram 0472.10.1 Using errorbar() to plot errorsBar drawing 0472.10.2 Example 10: Four tree species in different seasonsFine root biomass 0482.11 Summary of this chapter 0492.12 Exercise 049Chapter 3 Customization of Chart Auxiliary Elements 0523.1 Understand the common auxiliary elements of charts 0533.2 Set the label, scale range andScale label 0543.2.1 Set the label of coordinate axis 0543.2.2 Setting the scale range and scale label0563.2.3 Example 1: box office of Chinese films in 2019Leaderboard 0573.3 Add title and legend 0593.3.1 Add title 0593.3.2 Add key 0593.3.3 Example 2: Alipay Bill Report(Add title and legend) 0613.4 Display grid 0623.4.1 Display grid of specified style 0623.4.2 Example 3: vehicle speed and braking distanceRelationship (Add Grid) 0633.5 Add reference line and reference area 0643.5.1 Add reference line 0643.5.2 Add reference area 0653.5.3 Example 4: all classes of senior twoEnglish Performance Evaluation for Male and Female Students 0663.6 Add note text 0683.6.1 Adding Pointing Note Text0683.6.2 Adding Non directional Annotation Text0693.6.3 Example 5: 2013-2019Alibaba Taobao and TmallGMV (add note text) 0713.7 Add Form 0723.7.1 Adding a Custom Style Table 0723.7.2 Example 6: Ratio of jam and bread ingredients 0733.8 Summary of this chapter 0753.9 Exercise 075Chapter 4 Beautifying Chart Style 0774.1 Chart Style Overview 0784.1.1 Default Chart Style 0784.1.2 Modifying Chart Style 0794.2 Use color 0804.2.1 Use basic color 0814.2.2 Using the Color Mapping Table 0824.2.3 Example 1: Different species in two regionsBook purchase 0834.3 Select linetype 0844.3.1 Select the type of line 0844.3.2 Example 2: July 2017 vsJuly 2019 International foreign exchange marketTrend of USD/RMB exchange rate 0854.4 Adding data markers 0874.4.1 Add data of line chart or scatter chartMark 0874.4.2 Example 3: marking different productsQuarterly sales 0894.5 Setting font 0904.5.1 Setting font style 0904.5.2 Example 4: Temperature andTemperature (set font style) 0914.6 Switching theme style 0924.7 Filling area 0934.7.1 Filling the area between polygons or curves 0934.7.2 Example 5: colored "snowflake" 0954.8 Summary of this chapter 0964.9 Exercise 096Chapter 5 Drawing of Sub graph and Sharing of Coordinate Axes 0995.1 Drawing a sub drawing of a fixed area1005.1.1 Drawing single sub diagram1005.1.2 Example 1: A factory product A andSales analysis of product B last year 1035.1.3 Drawing multiple subgraphs 1055.1.4 Example 2: cat population ratio in some countriesAnalysis of the proportion of cases and dog owners 1065.2 Drawing a Subfigure of a Custom Area1075.2.1 Drawing a single subgraph 1075.2.2 Example 3: 2017 and 2018Treble user analysis 1095.3 Coordinate axis of shared subgraph 1105.3.1 Sharing coordinate axes of adjacent subgraphs 1115.3.2 Coordinate axis for sharing non adjacent subgraphs 1125.3.3 Example 4: annual average temperature of a regionRelationship with precipitation and evaporation 1145.4 Layout of subgraphs 1155.4.1 Constraint Layout1155.4.2 Tight layout 1175.4.3 Custom Layout1185.4.4 Example 5: A brand in the first half of 2018Automobile sales 1205.5 Summary of this chapter 1215.6 Exercise122Chapter 6 Customization of Coordinate Axes1256.1 Overview of coordinate axis 1266.2 Adding an axis to any location1276.3 Custom scale 1286.3.1 Position and format of customized scale 1286.3.2 Customized scale style 1306.3.3 Example 1: 24-hourAverage wind speed 1316.4 Hidden Ridge1336.4.1 Hiding All Ridges 1336.4.2 Hiding part of the ridge 1346.4.3 Example 2: 24-hourAverage wind speed (hidden ridge) 1356.5 Moving the spine 1366.5.1 Position of moving shaft ridge1366.5.2 Example 3: Sine and cosine curves 1376.6 Summary of this chapter 1386.7 Exercise 139Chapter 7 Drawing 3D Charts and Statistical Maps 1417.1 Plotting 3D charts using mplot3d 1427.1.1 Overview of mplot3d 1427.1.2 Drawing common 3D charts1437.1.3 Example 1: Stars in 3D space1457.2 Using animation to make moving pictures 1467.2.1 Overview of animation1477.2.2 Example 2: 3D space flickeringStars 1497.3 Using basemap to draw statistical map1507.3.1 Overview of basemap 1507.3.2 Example 3: Some urban populations in the United StatesDistribution 1537.4 Summary of this chapter 1557.5 Exercise 155Chapter 8 Advanced Drawing with MatplotlibChart 1588.1 Preparation of contour map 1598.2 Draw vector field streamline diagram1618.3 Drawing a Cotton Stick Figure 1638.4 Drawing dumbbell diagram1658.5 Drawing Gantt Chart1688.6 Mapping the population pyramid 1698.7 Draw funnel diagram1718.8 Drawing the Sankey Chart1738.9 Drawing a tree diagram 1768.10 Drawing a waffle chart 1798.11 Summary of this chapter 1818.12 Exercises181Chapter 9 The Rising Star of Data Visualization pyecharts 1849.1 Overview of pyecharts 1859.2 Basic knowledge of pyecharts 1879.2.1 Quick chart drawing 1879.2.2 Understanding charts 1889.2.3 Understanding configuration items1899.2.4 Rendering Chart1929.3 Drawing Common Charts1929.3.1 Draw a line diagram1929.3.2 Draw pie chart or doughnut chart 1949.3.3 Draw scatter plots 1969.3.4 Drawing 3D Column Chart1989.3.5 Drawing statistical map1999.3.6 Draw funnel diagram2009.3.7 Drawing a Sankey Diagram 2019.4 Drawing combination chart 2039.4.1 Parallel multi graph 2039.4.2 Sequence Multiple Diagram2059.4.3 Tabbed Multifigure2069.4.4 Timeline Carousel Multigraph 2089.5 Customizing Chart Theme2119.6 Integrated Web framework2129.7 Example: Hupu Community Analysis 2149.8 Summary of this chapter 2189.9 Exercise 219
Introduction: This book aims to introduce the open source Python algorithm library and mathematical toolkit Scipy.In recent years, complete ecosystems based on NumPy and SciPy have developed rapidly and been widely used in astronomy, biology, meteorology, climate science, materials science and other disciplines.This book, combined with a large number of code examples, shows in detail the powerful scientific computing capabilities of SciPy, including quantile standardization with NumPy and SciPy, image area network with ndimage, frequency and fast Fourier transform, contingency table with sparse coordinate matrix, linear algebra in SciPy, function optimization in SciPy, etc.Preface ixChapter 1 Elegant NumPy: Foundation of Python Scientific Application 11.1 Data introduction: what is gene expression 21.2 N-dimensional array of NumPy 61.2.1 Why use N-dimensional arrays instead of Python lists 71.2.2 Vectorization 91.2.3 Broadcasting 91.3 Exploring gene expression data sets101.4 Standardization 131.4.1 Standardization between samples 131.4.2 Intergenic standardization 191.4.3 Sample and gene standardization: RPKM 211.5 Summary 27Chapter 2 Quantile standardization with NumPy and SciPy 282.1 Obtaining Data 302.2 Differences in gene expression distribution among independent samples 302.3 Bi directional clustering of count data 332.4 Visualization of Clusters352.5 Predicting Survivors 372.5.1 Further work: using TCGA patient clusters 412.5.2 Further work: regenerate TCGA clusters 41Chapter 3 Implementation of image area network with ndimage 423.1 The image is a NumPy array 433.2 Filters in signal processing483.3 Image filtering (two-dimensional filter) 533.4 Universal filter: arbitrary function of adjacent value553.4.1 Exercise: Kangwei's Life Game 563.4.2 Exercise: Sobel gradient amplitude 563.5 Diagram and NetworkX Library573.6 Regional adjacency diagram 603.7 Elegant ndimage: how to create image objects according to image area633.8 Summary: average color segmentation 65Chapter 4 Frequency and Fast Fourier Transformation674.1 Frequency introduction 674.2 Example: Bird song spectrogram 694.3 History 744.4 Realizing 754.5 Selecting the length of the discrete Fourier transform 754.6 More Discrete Fourier Transform Concepts 774.6.1 Frequency and its sequence774.6.2 Windowing 834.7 Practical application: analyzing radar data864.7.1 Signal properties in frequency frequency914.7.2 After windowing 934.7.3 Radar image954.7.4 Further application of FFT 994.7.5 More Reading 994.7.6 Exercise: image convolution 100Chapter 5 Realization of contingency table with sparse coordinate matrix 1015.1 Train connection table1025.1.1 Exercise: Calculation complexity of confusion matrix 1035.1.2 Exercise: Another way to calculate the confusion matrix 1035.1.3 Exercise: Multi class confusion matrix 1045.2 Scipy.sparse data format 1045.2.1 COO format 1045.2.2 Exercise: COO represents 1055.2.3 Sparse row compression format1065.3 Sparse matrix application: image conversion 1085.4 Return to the contingency table1125.5 Contingency table in image segmentation 1135.6 Introduction to information theory1145.7 Information theory in image segmentation: information variation 1175.8 Converting NumPy Array Code to Use Sparse Matrice1195.9 Use information variation 120Chapter 6 Linear Algebra in SciPy1286.1 Fundamentals of Linear Algebra 1286.2 Laplacian matrix of figure 1296.3 Laplacian matrix of brain data 1346.3.1 Exercise: Displaying a Nearest Neighbor View1386.3.2 Exercise challenge: sparse matrix linear algebra 1386.4 PageRank: Linear Algebra for Reputation and Importance1396.4.1 Exercise: handling suspended nodes 1446.4.2 Exercise: equivalence of different eigenvector methods 1446.5 Conclusion 144Chapter 7 Function Optimization in SciPy 1457.1 SciPy optimization module: size.optimize 1467.2 Image registration with optimize 1527.3 Use the basin hopping algorithm to avoid the local minimum value1557.4 Selecting the correct objective function156Chapter 8 Using Toolz to Play Big Data on Notebook1638.1 Stream processing with yield 1648.2 Introducing Toolz stream library1678.3 k-mer count and error correction 1698.4 Curry: streaming seasoning1738.5 Return to k-mer count 1758.6 Genome wide Markov model177Postscript 182Appendix Exercise Answers 186About the Author 206Cover Introduction 206
Introduction: If you want to give full play to the powerful role of Python, and if you want to become a good Python engineer, you should first learn Pandas well.This is a book that comprehensively covers the general needs and pain points of Pandas users. Based on the principle of practicality and easy learning, Pandas is comprehensively explained in detail from multiple dimensions such as function, use, and principle. It is not only a rare primer for beginners to systematically learn Pandas, but also an essential query manual for experienced Python engineers.This book consists of 17 chapters and is divided into seven parts.Part I (Chapter 1-2) Introduction to PandasFirst, it introduces the functions, usage scenarios and learning methods of Pandas. Then it explains in detail the building of the Python development environment. After Z, it introduces a lot of basic functions of Pandas, aiming to guide readers to get a quick start.Part II (Chapter 3-5) Fundamentals of Pandas Data AnalysisPandas read and output data, index operation, data type conversion, query filtering, statistical calculation, sorting, displacement, data modification, data iteration, function application, etc. are explained in detail.Part III (Chapter 6-9) Data Form ChangeThis paper explains Pandas' grouping and aggregation operations, consolidation operations, comparison operations, pivoting, transposition, normalization, standardization, etc., and how to use multi-level indexes to raise and lower dimensions of data.Part IV (Chapter 10-12) Data cleaningIt explains the identification, deletion and filling of missing and duplicate values, the replacement and format conversion of data, the extraction, connection, matching, segmentation, replacement, formatting and virtual variable of text, as well as the application scenarios and operation methods of classified data.Part V (Chapter 13-14) Time series data analysisIt explains the processing and analysis of various time type data in Pandas, as well as the window calculation often used in time series data processing.Part VI (Chapter 15-16) VisualizationIt explains how the style function of Pandas makes data tables more expressive, and how the drawing function of Pandas makes data speak for itself.Part VII (Chapter 17) Practical CasesThis paper introduces the thinking process from demand to code, how to use the chain programming idea to improve the efficiency of code writing and data analysis, as well as the basic methods of data analysis and the data analysis tools and technology stacks that need to be mastered. In addition, it gives a large number of application cases and code explanations from the perspectives of data processing and data analysis.prefacePart I Introduction to PandasChapter 1 Introduction to Pandas and Quick Start1.1 What is Pandas1.1.1 Introduction to Python1.1.2 Application of Python1.1.3 Why not select R1.1.4 Introduction to Pandas1.1.5 Users of Pandas1.1.6 Basic Functions of Pandas1.1.7 Learning methods of Pandas1.1.8 Summary1.2 Environment construction and installation1.2.1 Python Environment Installation1.2.2 Introduction to Anaconda1.2.3 Installation of miniconda1.2.4 Multi Python version environment1.2.5 Installing the Editor1.2.6 Jupyter Notebook1.2.7 Installing the third-party library with pip1.2.8 Installing Jupyter Notebook1.2.9 Start Jupyter Notebook1.2.10 Using Jupyter Notebook1.2.11 Installing Pandas1.2.12 Summary1.3 Pandas Quick Start1.3.1 Installation Import1.3.2 Preparing Datasets1.3.3 Reading data1.3.4 View Data1.3.5 Validation data1.3.6 Indexing1.3.7 Data selection1.3.8 Sorting1.3.9 Group Aggregation1.3.10 Data conversion1.3.11 Add Column1.3.12 Statistical analysis1.3.13 Drawing1.3.14 Export1.3.15 Summary1.4 Summary of this chapterChapter 2 Data Structure2.1 Overview of data structure2.1.1 What is data2.1.2 What is data structure2.1.3 Summary2.2 Python data structure2.2.1 Figures2.2.2 String2.2.3 Boolean2.2.4 List2.2.5 tuples……Part II Fundamentals of Pandas Data AnalysisPart III Data Format ChangePart IV Data cleaningPart V Time series data analysisPart VI VisualizationPart VII Practical Cases
Points: 1Type: Technical documentUploader:HyperplatinumUpload time: May 30, 2021
Introduction: This book will lead readers to understand all aspects of the most popular scientific computing library NumPy.The book not only introduces the installation, use and various related concepts of NumPy, but also introduces how to use this latest open source software library to write code with good readability, high implementation efficiency and fast running speed in a way as close as possible to traditional mathematical languages.Finally, several NumPy related scientific computing projects are explored.In addition, this book will lay a solid foundation for you to master NumPy arrays and general functions. It will also teach you to draw with Matplotlib through examples and learn about Scipy related projects.This book will help you:• Learn advanced indexing techniques and linear algebra• Understand the adjustment of array shape and image size• Explore broadcast mechanisms and histograms• Analyze NumPy code and visually present the analysis results• Speed up code with Python• Use array interface to share data• Use of common functions and interoperability• Learn Matplotlib and SciPy, which is often used with NumPy
Points: 1Type: Technical documentUploader:HyperplatinumUpload time: May 30, 2021
Introduction: Still looking for a complete course of controlling, processing, sorting and analyzing structured data with Python?This book contains a large number of practical cases. You will learn how to use various Python libraries (including NumPy, Pandas, matplotlib and IPython) to efficiently solve various data analysis problems.Since the author Wes McKinney is the main author of the pandas library, this book can also be used as a practical guide for scientific computing to implement data intensive applications using Python.This book is suitable for analysts who are new to Python and Python programmers who are new to scientific computing.• Use the interactive shell IPython as your primary development environment.• Learn the basic and advanced knowledge of NumPy (Numerical Python).• Start with the data analysis tool of Pandas library.• Use high-performance tools to load, clean, transform, merge, and reshape data.• Use matplotlib to create scatter plots and static or interactive visualization results.• Use the groupby function of Pandas to slice, slice, and summarize data sets.• Processing various time series data.• Learn how to solve problems in Web analysis, social science, finance, economics and other fields through detailed cases.
Introduction: This book uses Matplotlib to explain the key knowledge and skills required for Python data visualization practice.This book mainly consists of Matplotlib introduction, refinement, exercise and expansion.At the same time, in order to facilitate readers to effectively practice the contents of the book, a large number of typical comprehensive cases will be attached to the relevant chapters.The code used in the book is the basic content of Python programming knowledge, which helps readers to focus their time and energy on the practice of data visualization itself.Therefore, this book is suitable for people of insight in various industries and fields who are interested in Python data visualization.Chapter 1 IntroductionChapter 1 Use Functions to Draw the Chart Elements of Matplotlib 21.1 Main functions for drawing matplotlib diagram elements 21.2 Preparing Data 31.3 Function usage for drawing matplotlib diagram elements 41.3.1 Function plot () - display the trend change of variable 41.3.2 Function scatter() -- find the relationship between variables 51.3.3 Function xlim() - set the numerical display range of x-axis 61.3.4 Function xlabel() -- set the label text of x-axis 71.3.5 Function grid() -- Draw grid lines of tick marks 81.3.6 Function axhline() - draw a horizontal reference line parallel to the x-axis 91.3.7 Function axvspan() - plot the reference area perpendicular to the x-axis 111.3.8 Function annotate () - add directional annotation text of graphic content details 121.3.9 Function text() -- Non directional annotation text for adding graphic content details 131.3.10 Function title () -- add the title of graphic content 151.3.11 Function legend() - text label legend for different graphics 161.4 Function combination application 17Chapter 2 Using Statistical Functions to Draw Simple Graphs 202.1 Function bar () - used to draw histogram 202.2 Function barh() - used to draw bar chart 222.3 Function hist() - used to draw histograms 232.4 Function pie() -- used to draw pie chart 252.5 Function polar () - used to draw polar diagram 262.6 Function scatter() -- used to draw bubble chart 272.7 Function stem () - used to draw cotton swab figure 292.8 Function boxplot () -- used to plot boxplot 302.9 Function errorbar() -- used to draw error bar chart 31Chapter 3 Drawing Statistical Graphs 333.1 Histogram 333.1.1 Application scenario - distribution display of qualitative data 333.1.2 Drawing Principle 333.2 Bar Chart353.3 Stacking Chart373.3.1 Stacking Histogram 373.3.2 Stacked Bar Chart383.4 Block diagram 393.4.1 Multi data Parallel Histogram 403.4.2 Multiple Data Parallel Bar Chart413.5 Parameter exploration 423.6 Stacked Line Chart, Discontinuous Bar Chart and Ladder Chart 443.6.1 Use stackplot() to draw a stacked line chart 443.6.2 Draw discontinuous bar graph with function broker_barh() 453.6.3 Draw ladder diagram with function step() 473.7 Histogram 483.7.1 Application scenario - distribution display of quantitative data 483.7.2 Drawing Principle 493.7.3 Relationship between Histogram and Histogram 503.7.4 Stacked Histogram 513.7.5 Different shapes of histograms 533.8 Pie Chart553.8.1 Application Scenario - Proportional Display of Qualitative Data 553.8.2 Drawing Principle 553.8.3 Extended Reading - Non Split Pie Chart 573.8.4 Case - Drawing an Embedded Circular Pie Chart 583.9 Box line diagram 603.9.1 Application scenario - distribution comparison of multiple sets of quantitative data 603.9.2 Drawing principle613.9.3 Extended reading meaning and calculation method of box, box whisker and outlier 633.9.4 Case 1 - Horizontal Box Line Diagram 653.9.5 Case 2 - Horizontal Box Line Diagram without Outliers 663.10 Error bar diagram673.10.1 Application scenario - error range of quantitative data673.10.2 Drawing principle683.10.3 Case 1 - Histogram with Error Bars 693.10.4 Case 2 - Bar chart with error bar 713.10.5 Case 3 - Multiple data parallel histogram with error bar723.10.6 Case 4 - Stacked Histogram with Error Bars 74Chapter 4 Improving Statistical Graphs 774.1 Adding Legend and Title774.1.1 Legend and title setting method774.1.2 Case 1 - Adjustment of display style of legend 794.1.3 Case 2 - Adjustment of display style of title 804.1.4 Case 3 - Pie chart with legend 824.2 Adjusting the scale range and scale label834.2.1 Method of adjusting scale range and scale label844.2.2 Extended reading - function subplot() 854.2.3 Case - Setting Axis Scale Labels in Reverse Order 864.3 Adding Tables to Statistical Graphs 87Chapter 2 ProgressChapter 5 Advanced Statistical Graph Drawing: Graph Styles 925.1 Setting the scale style of the axis 925.1.1 Usage of scale locator and scale formatter 925.1.2 Call the function in the module pyplot to set the scale style 955.1.3 Case 1 - Customization of scale labels and scale line styles 955.1.4 Case 2 - Scale labels in currency and time series style 965.2 Adding Notes with and without Indication 985.2.1 Adding methods with and without indication notes 985.2.2 Case 1 - Setting of Rounded Text Box 1005.2.3 Case 2 - Watermark effect of text 1015.2.4 Case 3 - Notes with radian indication on rounded wireframe 1025.2.5 Case 4 - Trend line with arrow indication 1045.2.6 Case 5 - Sankitu 1055.3 Realize the projection effect of title and axis labels 1075.3.1 Operation method for realizing projection effect of title and coordinate axis label 1075.3.2 Case - Adding a text box to the coordinate axis label 109Chapter 6 Main Functions to Divide Canvas 1116.1 Function subplot(): plot the sub area layout with the same geometry in the grid area1116.1.1 How to use the function subplot() 1126.1.2 Case 1 - Draw a line chart on the polar axis 1136.1.3 Case 2 - Scatter plot on polar axis 1146.1.4 Case 3 - Realize graphic display on the drawing area of non equidistant canvas1156.2 Function subplot2grid(): Make the subarea span the fixed grid layout 1166.2.1 How to use the function subplot2grid() 1166.2.2 Extended reading - how to use the GridSpec class in the module gridspec 1186.3 Function subplots(): Create a drawing mode with multiple sub areas on a canvas 1206.3.1 Case 1 - Create a drawing mode of a canvas and a sub area 1206.3.2 Case 2 - Create a drawing mode of one canvas and two sub areas 1226.3.3 Case 3 - Combination display of multiple statistical graphs 124Chapter 7 Coordinate Axis of Shared Drawing Area1287.1 Axis sharing a single drawing area1287.2 Sharing coordinate axes of different sub area drawing areas1307.2.1 Setting method1307.2.2 Case - Remove the gap between sub areas sharing the coordinate axis 1357.3 Coordinate axis of drawing area sharing individual subareas 1367.3.1 Setting method1367.3.2 Extended reading - adjust the coordinate axis range with the function autoscale() 138Part 3 ExerciseChapter 8 Advanced Application of Coordinate Axes 1428.1 Setting the position and display form of the coordinate axle1428.1.1 Case 1 - Add any number of coordinate axes to any position in the canvas1428.1.2 Case 2 - Adjust the display, hiding and scale range of the determined coordinate axis 1448.1.3 Extended reading - plot the coordinate axis 145 using the function axis()8.2 Use two methods to control the display of coordinate axis scale 1468.2.1 Method 1 - Call Axes. set_xticks() and Axes. set_yticks() instance methods 1468.2.2 Method 2 -- Call function setp() 1478.2.3 Case 1 - Customized display of cotton swab diagram 1498.2.4 Case 2 - Customized display of the style and position of the coordinate axis 1508.3 Control the display of coordinate axle1528.4 Move the position of the coordinate axis 154Chapter 9 Setting the Display Style of Line Type and Mark Type 1589.1 How to use dictionaries with different calling signatures 1589.1.1 Method 1 -- Call the setting form of keyword parameter in signature "fontdict=font" 1589.1.2 Method 2 - Keyword parameter setting form "* * font" 1609.2 Display style setting method of line type1619.3 Display style setting method of mark type1629.3.1 Method 1 - Single character mode1629.3.2 Method 2 - mathtext mode 1649.4 Extended reading 1669.4.1 Case 1 - Setting methods for different presentation forms of "dash" line style 1669.4.2 Case 2 - Setting method of marking filling pattern 1689.4.3 Case 3 - Setting method for calling signature of function plot () 170Part 4 ExpansionChapter 10 Matplotlib Configuration17410.1 Modifying the Matplotlib Configuration at the Code Level 17410.1.1 Method 1 - Call function matplotlib. rc() 17510.1.2 Method 2 - Call attribute dictionary matplotlib.rcParams 17510.2 Modifying the Matplotlib Configuration at the Project Level 17610.2.1 Path of configuration file 17610.2.2 Setting method177Chapter 11 Text Attribute Setting17911.1 Setting font attributes and text attributes17911.1.1 Method 1 - Change the font attribute value and text attribute value of the configuration file matplotlibrc 18111.1.2 Method 2 - Adjust font attribute value and text attribute value through attribute dictionary rcParams 18211.1.3 Method 3 - By setting keyword parameters of function18311.2 Extended reading - manually adding fonts 18411.3 Case - Visual display of main attributes of typeface 185Chapter 12 Use of Color18812.1 Using color parameters and color mapping table18812.1.1 Use of color parameter18812.1.2 Use of color mapping table19012.2 Comprehensive cases19312.2.1 Case 1 - Color use mode of mimic diagram 19312.2.2 Case 2 - Color Usage Mode of Scatter Chart19412.2.3 Case 3 - Color usage patterns of polar maps 19512.2.4 Case 4 - Color use mode of contour map 19712.2.5 Case 5 - Color usage mode of color scale198Chapter 13 Display and Save of Output Graphs 20013.1 Run command line to display output graphics 20013.1.1 Method 1 - Python shell mode 20013.1.2 Method 2 - IPython shell mode 20313.2 Saving output graphic20513.2.1 Method 1 - Use the "Save" button to store 20513.2.2 Method 2 - Saving by executing code statement207Appendix A Python Basics 208Appendix B NumPy Basics 213Appendix C Installation Methods of Matplotlib, NumPy and IPython217
Introduction: Matplotlib Practice of Python Data Visualization uses a large number of Matplotlib utility cases to explain the implementation methods of Python data visualization in various application directions.By learning these practical cases, readers can better master the advanced skills of Python data visualization.This book is mainly composed of five parts: graphics, elements, interaction, exploration and expansion. The practical cases in each part are conducive to expanding the application vision of matplotlib, and the example code in the case only involves the basic knowledge of Python.In this way, in the practice of Python data visualization, it is beneficial for readers to focus their time and energy on systematically mastering matplotlib knowledge and skills, and comprehensively improve their understanding and application level of matplotlib.Part 1 GraphicsChapter 1 Filling Geometric Figures with Colorstwo1.1 Color filling of polygontwo1.1.1 Color filling of regular polygontwo1.1.2 Color filling of irregular polygonfour1.2 Color filling of cross curvefive1.3 Extended Readingsix1.3.1 Color filling method of horizontal cross curvesix1.3.2 Color filling method of vertical cross curveeight1.4 Comprehensive case: color filling of intersecting and discontinuous curvesnineChapter 2 Drawing Geometric Figures Using Module Patchestwelve2.1 Realization method of circletwelve2.2 Implementation method of ellipsefifteen2.3 Implementation method of rectangleseventeen2.4 Drawing method of arc and wedgenineteen2.5 Extended Readingtwenty-two2.5.1 Using polylines to draw circlestwenty-two2.5.2 Drawing a Circle Using an Ellipsetwenty-five2.5.3 Using Wedges to Draw Pie Chartstwenty-six2.5.4 Using Wedges to Draw a Doughnut Pietwenty-eightChapter 3 Combination of Statistical Figuresthirty-one3.1 Diagram of discriminant analysis in machine learningthirty-one3.2 Date type time series chartthirty-three3.3 Adding probability density curve to histogramthirty-five3.4 Drawing area nested sub drawing areathirty-nine3.5 Extended reading: setting the general date scale markforty-twoChapter 2 ElementsChapter 4 Setting the Style and Layout of Text Contentforty-five4.1 Presentation style of text annotationforty-five4.1.1 Style of text boxforty-six4.1.2 Style of arrow for text notesforty-seven4.2 Layout of text contentforty-nine4.3 Extended Readingfifty-four4.3.1 Text Wrappingfifty-four4.3.2 Rotation angle of text contentfifty-seven4.3.3 Rotation mode of text contentfifty-nine4.3.4 Alignment of Multiline Textsixty-three4.3.5 Connecting Style of Text Annotation Arrowssixty-sixChapter 5 Adjustment of Measurement Unit and Methodseventy-six5.1 Realization method of different measurement unitsseventy-six5.1.1 Realization method of radian and angleseventy-six5.1.2 Realization method of cm and inchseventy-eight5.1.3 Realization method of second, Hz and minuteeighty5.1.4 Setting method of coordinate system of text annotation positioneighty-one5.2 Operating principle of different measuring methodseighty-threeChapter 6 Adjusting the Display Effect of Scale Marks, Scale Labels and Axis Ridgeseighty-seven6.1 Position adjustment of scale mark, scale label and axis labeleighty-seven6.2 Dynamic adjustment of scale mark position and valueninety6.3 Adjustment of major scale mark and minor scale markninety-two6.4 Display and hiding of axis ridgeninety-five6.5 Adjustment of axis ridge positionninety-eightChapter 3 InteractionChapter 7 Realize the Animation Effect of Graphicsone hundred and four7.1 Using module animation to draw animationone hundred and four7.2 Calling API of module pyplot to draw animationone hundred and sixChapter 8 Realizing GUI Effectsone hundred and tenUsage of Class 8.1 RadioButtonsone hundred and ten8.2 Usage of Cursorone hundred and thirteen8.3 Use of CheckButtonsone hundred and fourteenChapter 9 Realization of Event Handling Effectone hundred and eighteen9.1 Event result prompt appears after clicking Close Canvasone hundred and eighteen9.2 Implementation method of canvas local magnification effectone hundred and twentyChapter 4 ExplorationChapter 10 Importing Images from the Outside to Load into the Drawing Areaone hundred and twenty-four10.1 Diversified display of external imagesone hundred and twenty-four10.2 Topographyone hundred and twenty-six10.3 Thermal diagramone hundred and twenty-seven10.4 Set the picture to have hyperlink functionone hundred and thirty-one10.5 Adding an External Image on a Canvas Layerone hundred and thirty-six10.6 Diversified display effects of images with the help of filtersone hundred and forty10.6.1 Color reversalone hundred and forty-five10.6.2 Converting RGB channel NumPy array to single channel NumPy arrayone hundred and forty-sixChapter 11 Drawing 3D Graphicsone hundred and fifty11.1 Drawing a colored surface with a color scaleone hundred and fifty11.2 Layered display of 2D histogram projected onto the designated plane in 3D spaceone hundred and fifty-two11.3 Drawing Scatter Chart in 3Done hundred and fifty-fourChapter 12 Mappingone hundred and fifty-six12.1 Population of Australia's capital city and capital cityone hundred and fifty-six12.2 Distribution map of day and night geographical regions at the current time pointone hundred and sixty12.3 Visual presentation of distance between citiesone hundred and sixty-twoChapter 13 Comprehensive Cross Application Scenariosone hundred and sixty-seven13.1 Input data can use string instead of variableone hundred and sixty-seven13.2 Storing Canvas Graphics in PDF File Formatone hundred and sixty-nine13.3 Calling pyplot's API and object-oriented API to set graph propertiesone hundred and seventy-one13.4 Displaying the file size in the folder with a tree diagramone hundred and seventy-two13.5 Setting method of matplotlib style setone hundred and seventy-six13.6 Configuration Method of Matplotlib Backend Typeone hundred and eighty-onePart 5 ExpansionChapter 14 Rendering Text Content with the TeX Function of LaTeX and matplotlibone hundred and eighty-seven14.1 Preparation stepsone hundred and eighty-seven14.2 Case presentationone hundred and eighty-eight14.3 Extended Readingone hundred and ninetyChapter 15 Methods and Techniques of Using Matplotlib to Write Mathematical Expressionsone hundred and ninety-three15.1 Rules for editing stringsone hundred and ninety-three15.2 Setting the font effect of the output stringone hundred and ninety-four15.3 Learning TeX symbol writing rules through mathematical formulas and mathematical expressionsone hundred and ninety-five15.4 Learn the writing rules of TeX symbols through mathematical symbols and Greek letterstwo hundred and fourAppendix A Installation Method of SciPytwo hundred and nineAppendix B Usage of IPythontwo hundred and elevenAppendix C Installation and Use of mpl_toolkitstwo hundred and twenty-oneAppendix D Suggestions on the Use of Python 2 and Python 3 Software Versionstwo hundred and twenty-six
Introduction: With the development of information technology and the reduction of the cost of hardware equipment, there are massive data on the Internet today. To quickly obtain more effective information from these data, data visualization is an important part.For Python, Matplotlib is the traditional data visualization module, but it is not beautiful, static, and difficult to share, which limits the development of Python in data visualization.In order to solve this problem, a new dynamic visualization open source module Plotly came into being.Because Plotly is dynamic, beautiful, easy to use, rich in variety and other characteristics, it has been loved by developers since its inception.This book mainly introduces the application of Plotly in various fields of visualization, including basic drawing, data processing, web page development, program GUI, machine learning and quantitative investment, so that readers can quickly learn about Plotly.Most of the code in this book is written in Python language, and the application cases of Plotly in R language, MATLAB and JavaScript are also given.1.1 Introduction to Plotly1.2 Installation and Installation Environment1.3 Online initialization1.4 Privacy instructions for online drawing1.5 Start online mapping1.6 Using offline drawing library1.7 Parameter interpretation1.8 View HelpChapter 2 Plotly Basic Graphics2.1 Interpretation of basic cases2.2 Basic drawing process2.3 Scatter plot2.3.1 Basic case2.3.2 Style setting2.3.3 Application cases2.3.4 Parameter interpretation2.4 Bubble Chart2.4.1 Basic case2.4.2 Style Setting2.4.3 Zoom Settings2.4.4 Parameter interpretation2.5 Line Diagram2.5.1 Basic case2.5.2 Data gap and connection2.5.3 Data interpolation2.5.4 Filled Line Diagram2.5.5 Application cases2.5.6 Parameter interpretation2.6 Histogram2.6.1 Basic bar chart2.6.2 Columnar clusters2.6.3 Stacked Histogram2.6.4 Waterfall bar chart2.6.5 Graphic Style Settings2.6.6 Application cases2.6.7 Parameter interpretation2.7 Horizontal bar chart2.7.1 Basic case2.7.2 Application cases2.7.3 Parameter interpretation2.8 Gantt Chart2.8.1 Basic Gantt Chart2.8.2 Gantt Chart (indexed by numbers)2.8.3 Gantt Chart (indexed by category)2.8.4 Application cases2.9 Area map2.9.1 Basic area diagram2.9.2 Internal filled area diagram2.9.3 Stacking area chart2.10 Histogram2.10.1 Basic histogram2.10.2 Overlapping Histograms2.10.3 Stacked Histogram2.10.4 Cumulative histogram2.10.5 Application cases2.10.6 Parameter interpretation2.11 Pie Chart2.11.1 Basic Pie Chart2.11.2 Circular Pie Chart2.11.3 Style Setting2.11.4 Application cases2.11.5 Parameter interpretation2.12 More cases2.13 Overview of Plotly objectsChapter 3 Plotly Advanced Graphics3.1 Time series3.1.1 Usage3.1.2 Time range constraints3.2 Sliding selection control3.3 Forms3.3.1 Introduction case3.3.2 Add link3.3.3 Using Pandas3.3.4 Changing size and color3.3.5 Tables and Figures3.4 Multiple charts3.5 Multiple axes3.5.1 Double coordinate axes3.5.2 Multi axis3.5.3 Shared Axis3.6 Multiple sub graphs3.6.1 Double sub graph (method 1)3.6.2 Double sub graph (method 2)3.6.3 Multiple subgraphs (method 1)3.6.4 Multiple subgraphs (method 2)3.6.5 Split view interval3.6.6 Sub drawing shared coordinate axis (method 1)3.6.7 Sub drawing shared coordinate axis (method 2)3.6.8 Customization of sub graph coordinate axis3.6.9 Embedded sub diagram3.6.10 Mixed diagram3.7 Draw SVG3.7.1 Line drawing3.7.2 Line graph application: create tangent line of graph3.7.3 Drawing of rectangular chart3.7.4 Rectangular chart application: set time series area to highlight3.7.5 Drawing of circular chart3.7.6 Circular chart application: highlight cluster of scatter chartChapter 4 Plotly and Pandas4.1 Simple quick start4.1.1 Basic line diagram4.1.2 Basic scatter diagram4.1.3 Basic histogram4.2 Drawing with cufflinks4.2.1 Installing cufflinks4.2.2 Quick Start4.2.3 Quick data acquisition4.2.4 Custom Drawing4.2.5 Common classic graphics4.2.6 More casesChapter 5 Financial Mapping5.1 Quick drawing of K-line diagram5.1.1 Checking the Plotly Version5.1.2 Quickly draw OHLC (American Line) diagram5.1.3 Quick drawing of candle chart5.2 Optimization of K line diagram5.2.1 Filter non transaction time5.2.2 Set shape, color and annotation5.2.3 Add technical indicators5.3 Financial mapping using custom data5.4 Advanced financial mapping5.4.1 Introduction case5.4.2 Comprehensive casesChapter 6 Matplotlib6.1 Introduction to Matplotlib6.2 Installing Matplotlib6.3 Adjusting Matplotlib Parameters6.4 Common API Functions6.5 Linear function6.6 Add sub graph6.7 Determination of coordinate range6.8 Probability Diagram6.9 Scatter Chart6.10 Histogram6.11 More extensionsChapter 7 Plotly and Web Page Development7.1 Application of Plotly in Django7.1.1 Installation environment construction7.1.2 Installation environment test7.1.3 Introduction Case I7.1.4 Introduction Case II7.1.5 Extension of more cases7.1.6 Application Case I7.1.7 Application Case II7.2 Application of Plotly in Flask7.2.1 Installing Flask7.2.2 The smallest web application7.2.3 Template rendering7.2.4 Introduction Case I7.2.5 Introduction Case II7.2.6 Application casesChapter 8 Plotly and GUI Development8.1 Installation of PyQt8.2 Case interpretation8.3 Setting promoted widgets8.4 Use of Plotly_PyQt 58.5 More extensions (Plotly)8.6 Combination of Plotly and PyQt 5.68.7 More extensions (Matplotlib)8.8 Application case: display product portfolio informationChapter 9 Plotly and Machine Learning9.1 Application of Plotly in Sklearn9.1.1 Classification9.1.2 Regression problem9.1.3 Clustering9.2 PyTorch Visualizer9.2.1 Introduction to Visdom9.2.2 Installing Visdom9.2.3 Visdom and Plotly9.2.4 Basic concepts of Visdom9.2.5 Classic case of Visdom9.2.6 Visdom and PyTorchChapter 10 Application of Plotly in Quantitative InvestmentChapter 11 Application of Plotly in Other Languages11.1 Application of Plotly in R language11.1.1 Installation of R language11.1.2 Installing the Plotly module11.1.3 Plotly application analysis11.1.4 More extensions11.2 Application of Plotly in MATLAB11.2.1 Download and installation11.2.2 Introduction to foundation11.2.3 Classic cases11.2.4 More extensions11.3 Application of Plotly in JavaScript Language11.3.1 Introduction to foundation11.3.2 Scatter diagram11.3.3 Bar chart11.3.4 Sector diagram11.3.5 More extensions
Introduction: Author: Fabio NelliTranslator: Du ChunxiaoYear of publication: 2016Python is easy to learn, has rich libraries, and is extremely inclusive.This book shows how to use the powerful functions of Python language to extract, process and analyze data at the minimum programming cost. The main contents include: data analysis and basic introduction to Python, NumPy library,Pandas library, how to use pandas to read, write and extract data, and how to use matplotlib library and scikit-learn library to realize data visualization and machine learning respectively. Examples are used to demonstrate how to obtain information from raw data, embed D3 library and recognize handwritten digits.