实例介绍
版权归作者所有,任何形式转载请联系作者。 作者:Tommy(来自豆瓣) 来源:https://book.douban.com/review/8367790/ 本书内容对应的 Jupyter notebook 放在 GitHub 上。 https://github.com/jakevdp/PythonDataScienceHandbook
Python Data Science handbook Essential Tools for Working with data Jake vander plas Beijing. Boston. Farnham. Sebastopol. Tokyo OREILLY Python Data Science handbook by jake VanderPlas Copyright C 2017 Jake Vander Plas. All rights reserved Printed in the united states of america Published by o reilly Media, Inc, 1005 Gravenstein Highway North, Sebastopol, CA95472 O Reilly books may be purchased for educational, business, or sales promotional use. Online editions are alsoavailableformosttitles(http://oreilly.com/safari).Formoreinformationcontactourcorporate/insti tutionalsalesdepartment800-998-9938orcorporate@oreilly.com Editor: dawn schanafelt Indexer: Word Co Indexing Services, Inc. Production editor: Kristen brown Interior Designer: David Futato Copyeditor: Jasmine Kwityn Cover Designer: Karen Montgomery Proofreader: Rachel Monaghan Illustrator rebecca demarest December 2016 First edition Revision history for the first Edition 2016-11-17: First Release Seehttp://oreilly.com/catalog/errata.csp?isbn=9781491912058forreleasedetails The o reilly logo is a registered trademark of o reilly media, Inc. Python data Science handbook, the cover image, and related trade dress are trademarks of O Reilly Media, Inc While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate the publisher and the author disclaim all responsibilit for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights 978-1-491-91205-8 Table of contents Preface XI 1. IPython: Beyond Normal Python Shell or notebook Launching the IPython Shell Launching the Jupyter Notebook Help and Documentation in IPython Accessing Documentation with Accessing Source Code with Exploring modules with Tab Completion Keyboard Shortcuts in the ipython Shell Navigation Shortcuts Text Entry Shortcuts Command History Shortcuts Miscellaneous shortcuts 10 IPython Magic Commands 10 Pasting Code Blocks: %paste and %paste Running external Code: %run 12 Timing Code Execution: %timeit 12 Help on Magic Functions: ? %magic, and %lsmagic Input and Output History I Pythons In and Out objects 13 Underscore Shortcuts and Previous Outputs 15 Suppressing Output 15 Related Magic Commands 16 IPython and Shell Commands 16 Quick Introduction to the Shell 16 Shell Commands in ipython 18 Passing values to and from the shell 18 Shell-Related Magic Commands 19 Errors and Debugging 20 Controlling Exceptions: %xmode Debugging: When Reading Tracebacks Is Not Enough 22 Profiling and Timing Code 25 Timing Code Snippets: %timeit and %time 25 Profiling Full Scripts: %prun 27 Line-by-Line Profiling with %lprun 28 Profiling Memory Use: %memit and %mprun 29 More Ipython resources 30 Web resources 30 Books 31 2. Introduction to NumPy. ,,33 Understanding Data Types in Python 34 A Python Integer Is More Than Just an Integer 35 A Python List Is More Than Just a list 37 Fixed-Type arrays in python 38 Creating arrays from Python Lists 39 Creating Arrays from Scratch 39 NumPy Standard Data Types 41 The Basics of Num Py arrays 42 NumPy Array Attributes 42 Array Indexing: Accessing Single Elements 43 Array Slicing: Accessing Subarrays Reshaping of arrays Array Concatenation and Splitting 48 Computation on NumPy Arrays: Universal Functions 50 The Slowness of Loops 50 Introducing UFuncs 51 Exploring NumPy's UFuncs 52 Advanced func features 56 Ufuncs: Learning More ggregations: Min, Max, and Everything in Between 58 Summing the values in an Array 59 Minimum and maximum 59 Example: What Is the Average Height of US Presidents? 61 Computation on Arrays: Broadcasting g Broadcasting 63 Rules of Broadcasting Broadcasting in Practice 68 iv Table of Contents Comparisons, Masks, and Boolean Logic 70 Example: Counting Rainy Day 70 Comparison operators as ufuncs 71 Working with Boolean arrays Boolean arrays as masks ancy indexing 78 Exploring Fancy Indexing Combined Indexing 80 Example: Selecting Random Points 81 Modifying values with Fancy Indexir g 82 Example: Binning Data 83 Sorting arrays 85 Fast Sorting in NumPy: npsort and np.argsort 86 Partial Sorts: Partitioning 88 Example: k-Nearest Neighbors 88 Structured Data: NumPy's Structured Arrays 92 Creating Structured Arr 94 More Advanced Compound t ypes 95 Record arrays: Structured Arrays with a twist 96 On to pandas 6 3. Data Manipulation with PandaS Installing and Using Pandas 97 Introducing Pandas Objects 8 The Pandas Series Object 9 The Pandas Data Frame Object 102 The Pandas Index object 105 Data Indexing and Selection 107 Data Selection in Series 107 Data selection in data frame 110 Operating on Data in Pandas 115 Ufuncs: Index preservation 115 UFuncs: Index alignment 116 Ufuncs: Operations Between Data Frame and Series 118 Handling missing Data Trade-Offs in Missing Data Conventions 120 Missing data in pandas 120 Operating on null values 124 Hierarchical Indexing 128 a Multiply Indexed Series 128 Methods of multiIndex creation 131 Indexing and Slicing a multiIndex 134 Table of conten Rearranging multi-Indices 137 Data Aggregations on Multi-Indices 140 Combining Datasets: Concat and append 141 Recall: Concatenation of Num Py arrays 142 Simple Concatenation with pdconcat 142 Combining Datasets: Merge and join 146 Relational algebra 146 Categories of Joins 147 Specification of the merge Ke 149 Specifying Set Arithmetic for Joins 152 Overlapping Column Names: The suffixes Keyword 153 Example: US States Data 154 gregation and grouping 158 Planets data 159 Simple aggregation in Pandas 159 Group By: Split, Apply, Combine 161 Pivot tables 170 Motivating Pivot Table 170 Pivot Tables by hand 171 Pivot Table syntax 171 Example: Birthrate Data Vectorized String Operations 178 Introducing Pandas String Operations 178 Tables of Pandas String Methods 180 Example: Recipe Database 184 Working with Time Series 188 Dates and Times in Python 188 Pandas Time Series: Indexing by Time 192 Pandas Time series data structures 192 Frequencies and offsets 195 Resampling, Shifting, and Windowing 196 Where to Learn more 202 Example: Visualizing Seattle Bicycle Counts 202 High-Performance Pandas: eval) and query 208 Motivating query and eval(): Compound Expressions 209 pandas eval for Efficient Operations 210 Data Frame. eval() for Column-Wise Operations 211 Data Frame. query( Method 213 Performance: When to Use These functions 214 Further resources 215 Table of contents 4. Visualization with Matplotlib. 217 General Matplotlib Tips 218 Importing matplotlib 218 Setting styles 218 show( or No show(? How to Display Your Plots 218 Saving figures to file 221 Two Interfaces for the Price of One 222 Simple line plots 224 Adjusting the Plot: Line Colors and Styles 226 Adjusting the Plot: Axes Limits 228 Labeling Plots 230 Simple scatter Plots 233 Scatter Plots with plt plot 233 Scatter Plots with plt scatter 235 olot Versus scatter: A Note on Efficiency 237 Visualizing errors 237 Basic errorbars 238 Continuous errors 239 Density and contour plots 241 Visualizing a Three-Dimensional Function 241 Histograms, Binnings, and Density 245 Two-Dimensional Histograms and Binnings 247 Customizing Plot Legends 249 Choosing elements for the legend 251 Legend for Size of Points 252 Multiple legends 254 Customizing Colorbars 255 Customizing Colorbars 256 Example: Handwritten Digits 261 Multiple Subplots 262 oIt axes: Subplots by hand 263 plt subplot: Simple Grids of Subplots 264 plt. subplots: The Whole Grid in One Go 265 plt. GridSpec: More Complicated Arrangements 266 Text and annotation 268 Example: Effect of Holidays on US Births 269 Transforms and text position 270 Arrows and annotation 272 Customizing Ticks 275 Major and Minor Ticks 276 Hiding Ticks or labels 277 Reducing or Increasing the Number of Ticks 278 Table of( ontents|ⅶi Fancy Tick Formats 279 Summary of Formatters and Locators 281 Customizing Matplotlib: Configurations and Stylesheets 282 Plot Customization by hand 282 Changing the defaults: rcParams 284 Stylesheet 285 Three-Dimensional Plotting in Matplotlib 290 Three-Dimensional points and lines 291 Three-Dimensional Contour plots 292 Wireframes and Surface Plots 293 Surface Triangulations 295 Geographic Data with Basemap 298 Map Projections 300 Drawing a Map Background 304 Plotting data on maps 307 Example: California Cities 308 Example: Surface Temperature Data 309 Visualization with seaborn 311 Seaborn versus matplotlib 312 Exploring Seaborn Plots 313 Example: Exploring Marathon Finishing Times 322 Further resources 329 Matplotlib resources 329 Other Python Graphics Libraries 330 5. Machine Learning......,,,. 331 What Is Machine Learning? 332 Categories of Machine Learning 332 Qualitative Examples of Machine Learning Applications 333 Summary 342 ntroducing Scikit-Learn 343 Data Representation in Scikit-Learn 343 Scikit-Learns Estimator api 346 Application: Exploring Handwritten Digits 354 S ummary 359 Hyperparameters and Model validation 359 Thinking About Model Validation 359 Selecting the Best Model 363 Learning curves 370 Validation in practice: grid Search 373 Summary 375 Feature Engineering 375 I Table of Contents 【实例截图】
【核心代码】
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论