• Stars
    star
    669
  • Rank 67,451 (Top 2 %)
  • Language
    Jupyter Notebook
  • Created over 9 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python Quick Reference

Python Quick Reference

View as a Python script or a Jupyter notebook

This is the reference guide to Python that I wish had existed when I was learning the language.

Here's what I want in a reference guide:

  • High-quality examples that show the simplest possible usage of a given feature
  • Explanatory comments, and descriptive variable names that eliminate the need for some comments
  • Presented as a single script (or notebook), so that I can keep it open and search it when needed
  • Code that can be run from top to bottom, with the relevant objects defined nearby

This is not written as a full-fledged Python tutorial, though I ordered the topics such that you can read it like a tutorial (i.e., each topic depends only on material preceding it).

The guide was written using Python 2 but is fully compatible with Python 3. Relevant differences between Python 2 and 3 are noted throughout the guide.

Table of Contents

Click to jump to the relevant section of the script or the notebook:

  1. Imports (script, notebook)
  2. Data Types (script, notebook)
  3. Math (script, notebook)
  4. Comparisons and Boolean Operations (script, notebook)
  5. Conditional Statements (script, notebook)
  6. Lists (script, notebook)
  7. Tuples (script, notebook)
  8. Strings (script, notebook)
  9. Dictionaries (script, notebook)
  10. Sets (script, notebook)
  11. Defining Functions (script, notebook)
  12. Anonymous (Lambda) Functions (script, notebook)
  13. For Loops and While Loops (script, notebook)
  14. Comprehensions (script, notebook)
  15. Map and Filter (script, notebook)

Other Python Resources

If you like the general format of this guide, but need more explanation of each topic, I highly recommend reading the Appendix of Python for Data Analysis. It presents the essentials of the Python language in a clear and focused manner.

If you are looking for a resource that will help you to learn Python from scratch, this is my list of recommended resources.

Suggestions or Corrections

If there's a topic or example you'd like me to add to this guide, or you notice a mistake, please create a GitHub issue or leave a blog comment.

Thank you!

More Repositories

1

scikit-learn-videos

Jupyter notebooks from the scikit-learn video series
Jupyter Notebook
3,663
star
2

pandas-videos

Jupyter notebook and datasets from the pandas video series
Jupyter Notebook
2,143
star
3

scikit-learn-tips

πŸ€–βš‘ 50 scikit-learn tips
Jupyter Notebook
1,714
star
4

DAT8

General Assembly's 2015 Data Science course in Washington, DC
Jupyter Notebook
1,602
star
5

DAT4

General Assembly's Data Science course in Washington, DC
Jupyter Notebook
794
star
6

DAT3

General Assembly's Data Science course in Washington, DC
Roff
660
star
7

pycon-2019-tutorial

Data Science Best Practices with pandas
Jupyter Notebook
526
star
8

pycon-2016-tutorial

Machine Learning with Text in scikit-learn
Jupyter Notebook
441
star
9

pycon-2018-tutorial

Using pandas for Better (and Worse) Data Science
Jupyter Notebook
321
star
10

trump-lies

Tutorial: Web scraping in Python with Beautiful Soup
Jupyter Notebook
241
star
11

DAT7

General Assembly's Data Science course in Washington, DC
Jupyter Notebook
230
star
12

DAT5

General Assembly's Data Science course in Washington, DC
Jupyter Notebook
185
star
13

dplyr-tutorial

Tutorials for the dplyr package in R
159
star
14

pydata-dc-2016-tutorial

Tutorial: Machine Learning with Text in scikit-learn
Jupyter Notebook
74
star
15

python-data-analysis-workshop

Workshop: Intro to Python for Data Analysis
Python
71
star
16

python-data-science-workshop

Workshop: Python for Data Science
Python
61
star
17

kaggle-allstate

Allstate Purchase Prediction Challenge on Kaggle
R
58
star
18

kaggle-pycon-2015

Solution code from my winning submission to Kaggle's PyCon 2015 competition
Python
55
star
19

tidy-data

Commented R code from Hadley Wickham's "tidy data" presentation
R
29
star
20

PracticalMachineLearning

Course project for Practical Machine Learning: https://www.coursera.org/course/predmachlearn
13
star
21

coursera-getting-data

Class project for Coursera's "Getting and Cleaning Data" class
R
10
star
22

babynames

Baby Names by Birth Year
R
5
star
23

justmarkham

1
star