Python 3.7 Data Analysis: : With Live Projects For Absolute Beginners

What’s New in Python 3.7Python 3.7 is a general-purpose programming language. Python comes with a standard library that

602 27 9MB

English Pages 536 [484] Year 2019

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
What Is Python 3.7?......Page 8
Applications: When Should You Use Python?......Page 14
Web development:......Page 15
Graphical user interfaces (GUIs):......Page 16
Systems programming:......Page 17
Scientific computing:......Page 18
Text analytics:......Page 19
Execution speed performance:......Page 20
Global Interpreter Lock (GIL):......Page 21
Installation and Setup......Page 25
Which Python Version?......Page 26
Installing Python......Page 27
IDLE and the Python Shell......Page 29
Popular Tools......Page 39
Popular Frameworks......Page 40
Summary......Page 43
Continuous Delivery......Page 44
Time Savings......Page 45
Reliability of Releases......Page 49
Smaller Increments Make Triaging Easier......Page 50
Advanced Quality Assurance Techniques......Page 51
The Pipeline Architecture......Page 52
Separate Builds per Environment......Page 54
Everything Hinges on the Packaging Format......Page 56
Technology for Managing Debian Repositories......Page 57
Tooling for Installing Packages......Page 59
Controlling the pipeline......Page 60
Summary......Page 61
(Untitled)......Page 62
Typing Python......Page 63
Objects and Identifiers......Page 64
Numbers......Page 66
Real numbers......Page 67
Boolean numbers......Page 69
Complex numbers......Page 70
Namespaces and Modules......Page 71
Lists......Page 74
List indexing......Page 76
List mutability......Page 77
(Untitled)......Page 78
Tuples......Page 79
Strings......Page 80
Dictionaries......Page 81
Python if Statements......Page 82
The Python for loop......Page 84
The Python break statement......Page 86
List comprehensions......Page 87
Python while loops......Page 88
Syntax and scope......Page 89
Positional arguments......Page 95
Variable number of keyword arguments......Page 97
Python input/output functions......Page 98
The Python print function......Page 99
Anonymous functions......Page 103
Design by contract......Page 106
Postconditions......Page 110
Pythonic contracts......Page 111
Design by contract – conclusions......Page 112
Defensive programming......Page 114
Error handling......Page 115
Exception handling......Page 118
Do not expose tracebacks......Page 122
Avoid empty except blocks......Page 123
Include the original exception......Page 125
Using assertions in Python......Page 126
Separation of concerns......Page 127
Cohesion and coupling......Page 129
DRY/OAOO......Page 131
YAGNI......Page 134
KIS......Page 135
return instance......Page 136
EAFP/LBYL......Page 137
Composition and inheritance......Page 138
When inheritance is a good decision......Page 139
Anti-patterns for inheritance......Page 142
Structuring the code......Page 145
Summary......Page 147
An Introduction to Data Analysis......Page 148
Data Analysis......Page 149
Data Transformation......Page 153
Removing Duplicates......Page 154
Replacing Values via Mapping......Page 155
Adding Values via Mapping......Page 157
Rename the Indexes of the Axes......Page 158
Discretization and Binning......Page 160
Detecting and Filtering Outliers......Page 164
Permutation......Page 165
Data Aggregation......Page 166
GroupBy......Page 167
A Practical Example......Page 168
Hierarchical Grouping......Page 170
Chain of Transformations......Page 171
Functions on Groups......Page 172
Advanced Data Aggregation......Page 173
Conclusions......Page 176
pandas: The Python Data Analysis Library......Page 177
Installation from anaconda......Page 179
A Module Repository for Windows......Page 181
Testing Your panda's Installation......Page 182
Getting Started with pandas......Page 183
The Series......Page 184
Selecting the Internal Elements......Page 185
Assigning Values to the Elements......Page 186
Defining a Series from NumPy Arrays and Other Series......Page 187
Operations and Mathematical Functions......Page 188
Evaluating Vales......Page 189
NaN Values......Page 190
True dtype: bool......Page 191
Assigning Values......Page 192
Membership of a Value......Page 194
Filtering......Page 195
Transposition of a Dataframe......Page 196
The Index Objects......Page 197
Index with Duplicate Labels......Page 198
Other Functionalities on Indexes......Page 199
Reindexing......Page 200
Dropping......Page 203
Arithmetic and Data Alignment......Page 205
Filtering Out NaN Values......Page 207
Filling in NaN Occurrences......Page 209
Hierarchical Indexing and Leveling......Page 210
Reordering and Sorting Levels......Page 212
Summary Statistic by Level......Page 213
Reading and Writing using Python......Page 214
Writing Data in CSV......Page 215
Reading and Writing HTML Files......Page 217
Writing Data in HTML......Page 218
Reading Data from XML......Page 221
Reading and Writing Data on Microsoft Excel Files......Page 223
JSON Data......Page 224
price title......Page 226
The Format HDF5......Page 227
Loading and Writing Data with SQLite3......Page 229
Create a dataframe object:......Page 233
MongoDB......Page 234
Conclusions......Page 236
Understanding the Importance of Performance Testing......Page 238
JMeter and Python......Page 239
Configuring Your Test Plans......Page 241
Utilizing Your Test Plans Effectively......Page 246
Code Profiling with cProfile......Page 247
Run a cProfile Session......Page 248
Analyzing the cProfile Output......Page 252
Summary......Page 253
A first look at generators......Page 256
Generator expressions......Page 259
Iterating idiomatically......Page 260
Itertools......Page 261
Repeated iterations......Page 263
Text Analysis Techniques using Python......Page 264
The Natural Language Toolkit (NLTK)......Page 265
Search for a Word with NLTK......Page 266
Analyze the Frequency of Words......Page 268
Selection of Words from Text......Page 270
Bigrams and collocations......Page 271
Debugging with the Scientific Method......Page 273
Applying the Scientific Method......Page 274
Reproducing the Error......Page 276
Automating the Error......Page 278
Isolating the Defect......Page 279
The Strip-Down Strategy......Page 280
The Binary Search Strategy......Page 281
Explain the Problem to Someone Else......Page 282
Code Reviews......Page 283
Reading......Page 284
Cleaning Up......Page 286
Debugging with print Statements......Page 287
Print the Content of Variables......Page 288
Pretty-Printing Data Structures......Page 289
Simplify Input Data......Page 290
Start with Minimal Input......Page 291
Gradually Add More Input Data......Page 292
Switching print Output On and Off......Page 294
Complete Code......Page 295
Pros and Cons of Using print Statements......Page 296
Debugging with Introspection Functions......Page 297
Explorative Coding in IPython......Page 298
Exploring Files and Directories......Page 300
Overview of IPython Commands......Page 301
Exploring Namespaces......Page 302
Exploring Namespaces with dir()......Page 303
Exploring Namespaces of Objects......Page 304
Exploring Attributes in a Python Program......Page 306
Alternatives to dir in IPython......Page 307
Returns an image of a tile-based grid......Page 308
Object Summaries in IPython......Page 309
Analyzing Object Types......Page 310
(Untitled)......Page 311
Working in Public......Page 313
Collaborating on Step Definitions......Page 315
Final Thoughts......Page 316
Ab initio constructors......Page 321
Look-alike constructors......Page 322
Arithmetical operations on vectors......Page 324
Ufuncs......Page 326
Logical operations on vectors......Page 328
Two-Dimensional Arrays......Page 331
Maxima and minima......Page 332
Simple statistics......Page 333
Converting data to coefficients......Page 334
Linear Algebra......Page 335
More specialized operations on matrices......Page 337
Solving linear systems of equations......Page 338
SciPy......Page 339
Requirements......Page 341
RPCs......Page 342
RabbitMQ......Page 345
Installing Python requirements......Page 346
Creating your first Nameko microservice......Page 348
Unit-testing a Nameko microservice......Page 350
Exposing HTTP entry points......Page 351
Integration testing Nameko microservices......Page 352
An introduction to Redis......Page 354
Using Redis......Page 355
Adding a Redis Dependency Provider......Page 357
Designing the Client......Page 358
Creating our Message Service......Page 359
Putting it all together......Page 360
Saving messages......Page 361
Adding a save message RPC......Page 362
Retrieving all messages......Page 363
Adding a Jinja2 Dependency Provider......Page 365
Creating the template renderer......Page 366
Creating the Dependency Provider......Page 367
Making an HTML response......Page 368
Sending messages via POST requests......Page 370
Adding an AJAX POST request in jQuery......Page 371
Sorting messages......Page 373
Browser polling for messages......Page 375
Polling with JavaScript......Page 376
Summary......Page 378
The Interactive Debugger ipdb......Page 381
Starting the Debugger......Page 382
Starting ipdb from a Program......Page 383
Postmortem Debugging......Page 385
Commands at the Debugger Prompt......Page 386
Start Over......Page 387
Is the Program Without Defects Now?......Page 388
pudb......Page 389
cProfile......Page 390
Using six......Page 392
Using configparser Backport......Page 394
Queue......Page 395
socketserver......Page 396
Using Python-future......Page 397
Coming to Grips with Pylint......Page 399
Using Pylint......Page 400
Duplication......Page 401
bank......Page 402
The Messages Section......Page 403
Customizing Pylint’s Output......Page 404
Telling Pylint to Ignore Errors......Page 406
Covering All Your Code with Unit Tests......Page 407
Using Coverage......Page 408
Producing an HTML/XML Report......Page 410
Setting a Minimum Coverage Threshold......Page 411
Ignoring Coverage......Page 412
Summary......Page 413
Amortize......Page 414
Banks......Page 415
Budget......Page 416
Dates......Page 417
Timestamp......Page 418
Horizon......Page 419
Flows......Page 420
Visualization......Page 422
Updating......Page 423
Fun......Page 427
YAML......Page 429
Vacation II......Page 430
Loading YAML......Page 431
Trade-Offs......Page 432
Instantiate......Page 433
Orders......Page 436
Deposit......Page 437
Simulate......Page 438
Quotes......Page 439
Rebalance......Page 442
Conclusion......Page 444
What’s the Problem?......Page 445
Preparations......Page 447
First Implementation......Page 449
Second Implementation......Page 451
Listing A More Flexible News-Gathering Agent (newsagent2.py)......Page 455
Create a CGI version of the news script......Page 457
What’s the Problem?......Page 459
Preparations......Page 460
Listing. Creating the Database in MySQL......Page 461
First Implementation......Page 462
Writing the Main Script......Page 466
Listing. The Message Viewer (view.cgi)......Page 468
Writing the Edit Script......Page 469
Writing the Save Script......Page 470
What Now?......Page 472

Python 3.7 Data Analysis: : With Live Projects For Absolute Beginners

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers