• Stars
    star
    6,290
  • Rank 6,348 (Top 0.2 %)
  • Language
    Jupyter Notebook
  • Created almost 11 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Recipes for using Python's pandas library

Pandas cookbook

Binder

pandas is a Python library for doing data analysis. It's really fast and lets you do exploratory work incredibly quickly.

The goal of this cookbook is to give you some concrete examples for getting started with pandas. The docs are really comprehensive. However, I've often had people tell me that they have some trouble getting started, so these are examples with real-world data, and all the bugs and weirdness that entails.

It uses 3 datasets:

  • 311 calls in New York
  • How many people were on MontrΓ©al's bike paths in 2012
  • Montreal's weather for 2012, hourly

It comes with batteries (data) included, so you can try out all the examples right away.

Table of Contents

How to use this cookbook

The easiest way is to try it out instantly online using Binder's awesome service. Start by clicking here, wait for it to launch, then click on "cookbook", and you'll be off to the races! It will let you run all the code interactively without having to install anything on your computer.

To install it locally, you'll need Jupyter notebook and pandas on your computer.

You can get these using pip (you may want to do this inside a virtual environment to avoid conflicting with your other libraries).

  pip install -r requirements.txt

This can be difficult to get set up and require you to compile a whole bunch of things. I instead use and recommend Anaconda, which is a Python distribution which will give you everything you need. It's free and open source.

Once you have pandas and Jupyter, you can get going!

git clone https://github.com/jvns/pandas-cookbook.git
cd pandas-cookbook/cookbook
jupyter notebook

A tab should open up in your browser at http://localhost:8888

Happy pandas!

Running the cookbook inside a Docker container.

This repository contains a Dockerfile and can be built into a docker container. To build the container run following command from inside of the repository directory:

docker build -t jvns/pandas-cookbook -f Dockerfile-Local .

run the container:

docker run -d -p 8888:8888 -e "PASSWORD=MakeAPassword" <IMAGE ID>

you can find out about the id of the image, by checking

docker images

After starting the container, you can access the Jupyter notebook with the cookbook on port 8888.

License

Creative Commons License

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

Translations

There's a translation into Chinese of this repo.

More Repositories

1

dnspeep

spy on the DNS queries your computer is making
Rust
1,346
star
2

teeceepee

mini-TCP stack in Python, for fun
Python
552
star
3

kernel-module-fun

Some fun things you can do with kernel modules (all "bad ideas")
C
431
star
4

git-workflow

Tool to visualize your git workflow, in a pretty graph
Python
371
star
5

nginx-playground

JavaScript
354
star
6

dns-lookup

HTML
334
star
7

shell-examples

Shell
279
star
8

mess-with-dns

Source for Mess With DNS
Go
224
star
9

vue3-tiny-template

HTML
217
star
10

dns-weekend

Code for Implement DNS in a Weekend
Jupyter Notebook
192
star
11

tiny-resolver

Go
185
star
12

neural-nets-are-weird

Jupyter Notebook
166
star
13

gzip.jl

Gzip in julia! =D =D
C
161
star
14

git-commit-folders

Go
153
star
15

svg2notability

convert from svg to notability format
Python
137
star
16

twine-stories

twine
Python
133
star
17

svg_crossworder

Python script to generate SVG crosswords from a text file
Python
119
star
18

snake

snake, in C, with ncurses!
C
116
star
19

dig-pretty

Python
81
star
20

zine-formatter

Small Python script for formatting zines into booklets
Python
77
star
21

vimconfig

Vim Script
55
star
22

julia-drawings

CSS
55
star
23

focus-reply-fastmail

a hacky focus & reply feature for fastmail
JavaScript
52
star
24

howcomputer

how does a computer even (or: fun with profiling)
C
52
star
25

snake.rs

snake in Rust!
Rust
51
star
26

mastodon-threaded-replies

JavaScript
50
star
27

tiny-tls

Go
49
star
28

ltrace-bcc

ltrace clone that uses bcc + uprobes instead of ptrace
Rust
46
star
29

dns-doctor

Go
46
star
30

talks

IPython notebooks and slides for talks I've given
Jupyter Notebook
44
star
31

gzip-huffman-tree

Prints the Huffman table for a gzip file
Python
44
star
32

zine-translations

SVGs of zines that are easier to translate than a PDF
Shell
41
star
33

turn-off-retweets

JavaScript
35
star
34

git-oops

Python
33
star
35

tweets-archive

JavaScript
31
star
36

tiny-python-dns-server

Python
30
star
37

unix-command-survey

Visualization of correlations between HN users' .bash_history
JavaScript
29
star
38

manage-boosts

manage mastodon boosts
JavaScript
28
star
39

guys-guys-guys

The results from a short survey I ran on the use of "guys"
Shell
26
star
40

fun-with-threads

C
23
star
41

masters-thesis

My master's thesis, on the algebra of topological quantum computing
TeX
20
star
42

syscall_menagerie

A menagerie of Linux system calls
19
star
43

forestspy

spy on your random forests
Jupyter Notebook
19
star
44

dotfiles

My dotfiles
Vim Script
18
star
45

julias-first-programs

Python
18
star
46

font-mixer

an attempt at mixing 2 handwriting fonts into a fancier version
Python
16
star
47

sql-playground.wizardzines.com

Vue
16
star
48

ruby-mem-watcher-demo

Rust
16
star
49

nixpkgs

my nix packages
Nix
15
star
50

piper

See which processes are connected to other processes with pipes!
15
star
51

multi-gotty

Go
14
star
52

aoc2020

Python
13
star
53

aoc2022

Rust
12
star
54

tinybuild

Shell
11
star
55

website-example

HTML
11
star
56

discord-neighbourbot

Python
11
star
57

stealthistalk

talk ideas for you to steal
10
star
58

tiny-remote-login

Go
9
star
59

stats-fun

Jupyter Notebook
8
star
60

inside-git

Python
7
star
61

biximap

An improved version of the map at http://montreal.bixi.com
JavaScript
7
star
62

misc-git-tools

a git command line tool that I wrote in 10 minutes
Python
7
star
63

swiss_army_knife_talk

Jupyter Notebook
6
star
64

incident-service

JavaScript
4
star
65

lozyafun2

lozya fun 2
JavaScript
4
star
66

magical-orchestra

Lyndsey and Julia's Magical Orchestra
Clojure
4
star
67

linux-playground

HTML
3
star
68

dns-summer-camp

some materials for a workshop
3
star
69

failed-decryption

Ruby
3
star
70

comments-policy

3
star
71

hadoop_fun

Python
3
star
72

linux-wizard-project

HTML
3
star
73

predixi

Find out when that station is going to be empty! Huge WIP.
Python
3
star
74

rbspy-archive

archive of old rbspy commits (pre-squash)
Rust
3
star
75

cssjs-exercises

HTML
3
star
76

vaccine-scraper

Python
3
star
77

colab-fun

Jupyter Notebook
3
star
78

quicksend

Tiny utility for sending files insecurely on your local network
Python
3
star
79

rust-fun

Fun things, with Rust!
Rust
2
star
80

manage-twitter

JavaScript
2
star
81

axidraw-fun

some miscellaneous axidraw scripts
Python
2
star
82

mithril-tiny-template

HTML
2
star
83

mtlpytutorial

Scripts for montreal python workshop lecture
Python
2
star
84

biximap2

an attempt at a bixi station map
JavaScript
2
star
85

branch-example

2
star
86

change-ringing

Change ringing practice
Clojure
2
star
87

julia-test-app

HTML
1
star
88

clojent

A BitTorrent client in Clojure? WE WILL SEE.
Clojure
1
star
89

ld_preload_fun

C
1
star
90

jvns

1
star
91

sketchrnn-lots-of-faces

JavaScript
1
star
92

mess-with-dns-backend-old

Go
1
star
93

test-mac-freeze

Rust
1
star
94

fake-website

CSS
1
star
95

git-merge-sad

1
star
96

jvns-redesign

CSS
1
star
97

hey-mr-kernigan

Some exercises from Kernigan & Ritchie
C
1
star