DataFrame
Pandas cheat sheet. GitHub Gist: instantly share code, notes, and snippets. Load a json file into a pandas data frame import pandas as pd #this assumes one json item per line in json file df=pd.readjson('pathtojsonfile', lines=True) Pandas DataFrame Manipulation Group by a column and keep the column afterwards df.groupby('columnname').aggregatefunction.resetindex.
DataFrames |Load Data |Indexing |Selection |Timeseries |Clean |Explore |Grouping |Join |SQL
Load data
DataFrames |Load Data |Indexing |Selection |Timeseries |Clean |Explore |Grouping |Join |SQL
Indexing
DataFrames |Load Data |Indexing |Selection |Timeseries |Clean |Explore |Grouping |Join |SQL
Selection
DataFrames |Load Data |Indexing |Selection |Timeseries |Clean |Explore |Grouping |Join |SQL
TimeSeries
DataFrames |Load Data |Indexing |Selection |Timeseries |Clean |Explore |Grouping |Join |SQL
Resample strings
BusinessDay | ‘B’ | business day (weekday) |
Week | ‘W’ | one week |
MonthEnd | ‘M’ | calendar month end |
MonthBegin | ‘MS’ | calendar month begin |
BusinessMonthBegin | ‘BMS’ | business month begin |
YearEnd | ‘A’ | calendar year end |
YearBegin | ‘AS’ or ‘BYS’ | calendar year begin |
BYearEnd | ‘BA’ | business year end |
BYearBegin | ‘BAS’ | business year begin |
Easter | None | Easter holiday |
CustomBusinessHour | ‘CBH’ | custom business hour |
Day | ‘D’ | one absolute day |
Hour | ‘H’ | one hour |
Minute | ‘T’ or ‘min’ | one minute |
Second | ‘S’ | one second |
Milli | ‘L’ or ‘ms’ | one millisecond |
Micro | ‘U’ or ‘us’ | one microsecond |
Nano | ‘N’ | one nanosecond |
Datetime string format
%a | : : Locale’s abbreviated weekday name. |
%A | : : Locale’s full weekday name. |
%b | : : Locale’s abbreviated month name. |
%B | : : Locale’s full month name. |
%c | : : Locale’s appropriate date and time representation. |
%d | : : Day of the month as a decimal number [01,31]. |
%f | : : Microsecond as a decimal number [0,999999], zero-padded on the left |
%H | : : Hour (24-hour clock) as a decimal number [00,23]. |
%I | : : Hour (12-hour clock) as a decimal number [01,12]. |
%j | : : Day of the year as a decimal number [001,366]. |
%m | : : Month as a decimal number [01,12]. |
%M | : : Minute as a decimal number [00,59]. |
%p | : : Locale’s equivalent of either AM or PM. |
%S | : : Second as a decimal number [00,61]. |
%U | : : Week number of the year (Sunday as the first day of the week) |
%w | : : Weekday as a decimal number [0(Sunday),6]. |
%W | : : Week number of the year (Monday as the first day of the week) |
%x | : : Locale’s appropriate date representation. |
%X | : : Locale’s appropriate time representation. |
%y | : : Year without century as a decimal number [00,99]. |
%Y | : : Year with century as a decimal number. |
%z | : : UTC offset in the form +HHMM or -HHMM. |
%Z | : : Time zone name (empty string if the object is naive). |
%% | : : A literal ‘%’ character. |
Clean
DataFrames |Load Data |Indexing |Selection |Timeseries |Clean |Explore |Grouping |Join |SQL
Explore
DataFrames |Load Data |Indexing |Selection |Timeseries |Clean |Explore |Grouping |Join |SQL
Grouping
DataFrames |Load Data |Indexing |Selection |Timeseries |Clean |Explore |Grouping |Join |SQL
Join
DataFrames |Load Data |Indexing |Selection |Timeseries |Clean |Explore |Grouping |Join |SQL
SQL
DataFrames |Load Data |Indexing |Selection |Timeseries |Clean |Explore |Grouping |Join |SQL
Data Mining¶
- Data Mining. PDF only.
Importing Data¶
- Importing Data. PDF.
Keras¶
- Keras. PDF.
Linear Algebra (with Numpy)¶
- Linear Algebra. PDF only.
- SciPy Linear Algebra. PDF.
Machine Learning¶
Machine Learning. PDF only.
- Supervised Learning;
- Unsupervised Learning;
- Deep Learning;
- Machine Learning Tips and Tricks;
- Probabilities and Statistics;
- Linear Algebra and Calculus.
Super pense-bête Machine Learning. PDF only.
Microsoft Azure Machine Learning. PDF.
- scikit-learn. PDF.
.
Pandas Cheat Sheet Github Pdf
Numpy¶
- NumPy/SciPy/Pandas Cheat Sheet. PDF.
- Numpy. PDF.
Pandas¶
- Pandas DataFrame Notes. PDF only.
- Pandas. PDF.
- Pandas. PDF.
- Data Wrangling with Pandas. PDF.
Spark¶
- PySpark. PDF.
- PySpark SQL. PDF.
Visualization¶
Bokeh¶
- Bokeh. PDF.
Folium¶
- Folium. PDF.
Matplotlib¶
- Matplotlib Notes. PDF only.
- Matplotlib. PDF.
Pandas Cheat Sheet Pdf
Plotly¶
- Plotly. PDF only.
Seaborn¶
- Seaborn. PDF.