Entries by tag: python

Including child/synonym tags

Pandas Dataframe Examples: Column Operations  09 Dec 2018    pandas dataframes
Examples on how to modify pandas DataFrame columns, append columns to dataframes and otherwise transform indiviudal columns. Read More ›

Numpy Array (ndarray) Examples  08 Dec 2018    numpy
Numpy Array-like data structures (ndarrays) are the bread and butter of a lot of data work done these days. Read More ›

Python 3 Subprocess Examples  03 Nov 2018    python3
Examples on how to spawn and control OS-level processes from a python script, using the new Subprocess module. Read More ›

Interactive controls for Jupyter notebooks: Python Examples  19 Sep 2018    jupyter python
Examples on how to add interactive controls to jupyter notebooks. Read More ›

Caching Function Results in Python: Examples using Joblib and Functools  15 Sep 2018    python caching
In many cases (web development, data analysis, etc) it's useful to be able to store results that take long to re-compute. These solutions allow you to save results (either in memory or on disk) so that all function calls after the first one become constant-time lookups. Read More ›

Heads-up for Deploying Scikit-learn Models to Production: Quick Checklist  01 Sep 2018    scikit-learn production
A couple of tips for addressing common problems and unexpected situations when using scikit-learn models in production.. Read More ›

Cross-Validation Examples with Scikit-Learn  01 Sep 2018    scikit-learn
Using cross-validation within scikit-learn. Read More ›

Mutate for Pandas Dataframes: Examples with Assign  15 Jul 2018    pandas
Assign is a function that mutates a dataframe in place and can be used for chained operations. Read More ›

Using SQL-like Syntax with Pandas Dataframe: Query and Eval Examples  05 Jul 2018    pandas
Use SQL-like syntax to perform in-place queries on pandas dataframes. Read More ›

Example Project Template: Serve a Scikit-learn Model via a Flask API  27 Jun 2018    flask scikit-learn
Full (albeit simple) example on how to create a simple Flask API to serve predictions using a pre-trained scikit-learn model. Includes supporting features such as logging, error handling, input validation, etc. Full code available on Github. Read More ›

Add Labels and Text to Matplotlib Plots: Annotation Examples  22 Jun 2018    matplotlib
Examples on how to add simple annotations and labels to your matplotlib plots. Read More ›

Pandas Dataframe: Union and Concat Examples  14 Jun 2018    pandas
Emulate SQL union and union all behaviour, among other stuff. Read More ›

Scikit-Learn examples: Making Dummy Datasets  02 May 2018    scikit-learn
Make dummy datasets to test out classifiers and/or parameter configurations in Scikit-learn. Read More ›

Visualizing Machine Learning Models: Examples with Scikit-learn, XGB and Matplotlib  23 Apr 2018    matplotlib machine-learning scikit-learn
Examples on how to use matplotlib and Scikit-learn together to visualize the behaviour of machine learning models, conduct exploratory analysis, etc. Read More ›

Joining Data on Pandas: Dataframe Merge Examples  17 Apr 2018    pandas
Examples on how to use pandas.merge to do SQL-style joins on pandas dataframes. Read More ›

Visualization Options for Jupyter Notebooks  14 Apr 2018    jupyter python
Use pandas, numpy and matplotlib options for enhancing visualization in Jupyter notebooks. Read More ›

Python Dict Examples  31 Mar 2018    python
Examples of common dict operations. Read More ›

Docstrings by Example: Documenting Python Code the Right Way  24 Feb 2018    python documentation testing
Examples to help you document your Python code using any of the commonly used docstring styles. Read More ›

Python Logging: Reference and Examples  17 Feb 2018    python logging
Examples on how to setup and configure loggin in Python applications. Examples include log rotation, log rotation with compression, logging in Flask applications, etc. Read More ›

Python Unit Testing with unittest: Reference and Examples  12 Feb 2018    python testing
Testing is needed in all but the most trivial applications. The unittest module is very widely used in Python because it's part of the standard library, starting with Python 2.1. Read More ›

Pandas Dataframe: Plot Examples with Matplotlib and Pyplot  22 Dec 2017    pandas pyplot matplotlib dataframes
Examples on how to plot data directly from a Pandas dataframe, using matplotlib and pyplot. Read More ›

Python CSV Module: Reference and Examples  12 Dec 2017    python csv
Examples on how to read and write CSV files and configure Python's CSV module. Read More ›

Package a Python Project and Make it Available via pip install: Simple Example  15 Nov 2017    python data-newsletter-6
It's easy to package some code you wrote as a package. Publish your Python code to PyPi to have other people use and contribute to it! Read More ›

Pip Install a Project having a setup.py file: an Example  11 Nov 2017    python
You can use pip to install a Python project that uses a setup.py setup file. Read More ›

Python number formatting examples  04 Nov 2017    python formatting
Examples on how to format numbers in Python, e.g. rounding, truncating, etc. Read More ›

Scikit-Learn Pipeline Examples  21 Oct 2017    scikit-learn
Examples of how to use classifier pipelines on Scikit-learn. Includes examples on cross-validation regular classifiers, meta classifiers such as one-vs-rest and also keras models using the scikit-learn wrappers. Read More ›

Pandas DataFrame: GroupBy Examples  11 Oct 2017    pandas groupby
Examples of specific ways to do what you want using groupby on Pandas Dataframes. Read More ›

Matplotlib: Pyplot By Example  05 Oct 2017    pyplot matplotlib
Examples for common operations on PyPlot, like changing figure size, changing title and tick sizes, changing legends, etc. Read More ›

Parallel For Loops in Python: Examples with Joblib  02 Oct 2017    python parallel
Joblib.Parallel is a simple way to spread your for loops across multiple cores, for parallel execution. Read More ›

Feature Scaling: Quick Introduction and Examples using Scikit-learn  26 Sep 2017    data-science python data-preprocessing
Feature Scaling techniques (rescaling, standardization, mean normalization, etc) are useful for all sorts of machine learning approaches and *critical* for things like k-NN, neural networks and anything that uses SGD (stochastic gradient descent), not to mention text processing systems. Included examples: rescaling, standardization, scaling to unit length, using scikit-learn. Read More ›

Matplotlib, Pyplot, Pylab etc: What's the difference between these and when to use each?  26 Sep 2017    python data-visualization data-newsletter-5
Do you often get confused with terms like maptlotlib, pyplot, pylab, figures, axes, gcf, gca, etc and wonder what they mean? Matplotlib is the toolkit, PyPlot is an interactive way to use Matplotlib and PyLab is the same thing as PyPlot but with some extra shortcuts. Read More ›

Seaborn by Example: Data Visualization and Plotting using Python  09 Sep 2017    python data-visualization plotting
Seaborn is a higher-level interface to Matplotlib. It has a more convenient API and has useful data visualization functions right out of the box. Read More ›

Pandas for Large Data  13 Aug 2017    data-newsletter-4 pandas performance
In order to successfully work with large data on Pandas, there are some ways to reduce memory usage and make sure you get good speed performance. Read More ›

Python Pickling for Data Science: Examples and Tips on how to use Pickle as part of your Data Work  12 Jul 2017    python pickle data-science
Pickle is a well-known Python tool for saving arbitrary variable contents into file. Here are a couple of examples and tips on how you can use it to make your data science work more efficient and easily reproducible. Read More ›

Scikit-Learn Cheatsheet: Reference and Examples  10 Mar 2017    wip scikit-learn
Just a couple of things you may find yourself doing over and over again when working with scikit-learn. Read More ›

Python Json Module: Reference and Examples  16 Jan 2017    wip python json
Python CLI Scripts and Applications: Reference + Examples  04 Jan 2017    wip python cli command-line
Setup Keras+Theano Backend and GPU on Ubuntu 16.04  10 Sep 2016    keras gpu theano
A couple of pointers on how to get up and running with Keras and Theano on a clean 16.04 Ubuntu machine. Read More ›

Numpy Distributions and Statistical Functions: Examples + Reference  10 Sep 2016    numpy statistics
A couple of examples of things you will probably want to do when using numpy for data work, such as probability distributions, PDFs, CDFs, etc. Read More ›

Python Datetime and Datetime Examples  04 Jul 2016    python date datetime
Examples on how to create and manipulate date and datetime objects using Python. Read More ›

Working with Files & the Filesystem in Python: Reference and Examples  26 Mar 2016    python
Examples on how to perform filesystem-related tasks using python. Tasks include reading and writing to files, listings files and manipulating the path. Read More ›

Python Environment Cheatsheet  25 Mar 2016    python
Python Regular Expressions: Examples & Reference  16 Mar 2016    python regex
Pandas DataFrame by Example  15 Dec 2015    pandas python
Lots of examples of ways to use one of the most versatile data structures in the whole Python data analysis stack. Learn how to slice and dice, select and perform commonly used operations on DataFrames. Read More ›

One-Hot Encoding a Feature on a Pandas Dataframe: Examples  27 Nov 2015    pandas
One-hot encoding is a simple way to transform categorical features into vectors that are easy to deal with. Learn how to do this on a Pandas DataFrame. Read More ›

Spark SQL: Examples on pyspark  18 Oct 2015    wip pyspark sparksql
Functional Programming with Python: Quick Reference with Examples  16 Apr 2015    python functional programming
Getting started with Python NLTk on Ubuntu  29 Mar 2015    python nltk
Python Environment Examples and Gotchas: Pip, Virtualenvs, etc   19 Jun 2014    pip virtualenv
How to Install pip on Ubuntu  02 Jun 2014    ubuntu pip
Python 1-Minute Tutorial for Those with Previous Programming Experience  20 Feb 2014    python