Skip to main content

Modin: Make your pandas code run faster by changing one line of code.

Project description

Scale your pandas workflows by changing one line of code

Slack PyPI version

What is Modin?

Modin is a drop-in replacement for pandas. While pandas is single-threaded, Modin lets you instantly speed up your workflows by scaling pandas so it uses all of your cores. Modin works especially well on larger datasets, where pandas becomes painfully slow or runs out of memory.

Using modin is as simple as replacing the pandas import:

# import pandas as pd
import modin.pandas as pd

Installation

From PyPI

Modin can be installed with pip on Linux, Windows and MacOS:

pip install modin[all] # (Recommended) Install Modin with all of Modin's currently supported engines.

If you want to install Modin with a specific engine, we recommend:

pip install modin[ray] # Install Modin dependencies and Ray.
pip install modin[dask] # Install Modin dependencies and Dask.

Modin automatically detects which engine(s) you have installed and uses that for scheduling computation.

From conda-forge

Installing from conda forge using modin-all will install Modin and three engines: Ray, Dask, and Omnisci.

conda install -c conda-forge modin-all

Each engine can also be installed individually:

conda install -c conda-forge modin-ray  # Install Modin dependencies and Ray.
conda install -c conda-forge modin-dask # Install Modin dependencies and Dask.
conda install -c conda-forge modin-omnisci # Install Modin dependencies and Omnisci.

Choosing a Compute Engine

If you want to choose a specific compute engine to run on, you can set the environment variable MODIN_ENGINE and Modin will do computation with that engine:

export MODIN_ENGINE=ray  # Modin will use Ray
export MODIN_ENGINE=dask  # Modin will use Dask

This can also be done within a notebook/interpreter before you import Modin:

from modin.config import Engine

Engine.put("ray")  # Modin will use Ray
Engine.put("dask")  # Modin will use Dask

Check this Modin docs section for Omnisci engine setup.

Note: You should not change the engine after your first operation with Modin as it will result in undefined behavior.

Which engine should I use?

On Linux, MacOS, and Windows you can install and use either Ray or Dask. There is no knowledge required to use either of these engines as Modin abstracts away all of the complexity, so feel free to pick either!

On Linux you also can choose Omnisci, which is an experimental engine based on OmnisciDB and included in the Intel® Distribution of Modin, which is a part of Intel® oneAPI AI Analytics Toolkit (AI Kit).

Pandas API Coverage

pandas Object Modin's Ray Engine Coverage Modin's Dask Engine Coverage
pd.DataFrame
pd.Series
pd.read_csv
pd.read_table
pd.read_parquet
pd.read_sql
pd.read_feather
pd.read_excel
pd.read_json ✳️ ✳️
pd.read_<other> ✴️ ✴️

Some pandas APIs are easier to implement than others, so if something is missing feel free to open an issue!

More about Modin

For the complete documentation on Modin, visit our ReadTheDocs page.

Scale your pandas workflow by changing a single line of code.

Note: In local mode (without a cluster), Modin will create and manage a local (Dask or Ray) cluster for the execution.

To use Modin, you do not need to specify how to distribute the data, or even know how many cores your system has. In fact, you can continue using your previous pandas notebooks while experiencing a considerable speedup from Modin, even on a single machine. Once you've changed your import statement, you're ready to use Modin just like you would with pandas!

Faster pandas, even on your laptop

The modin.pandas DataFrame is an extremely light-weight parallel DataFrame. Modin transparently distributes the data and computation so that you can continue using the same pandas API while working with more data faster. Because it is so light-weight, Modin provides speed-ups of up to 4x on a laptop with 4 physical cores.

In pandas, you are only able to use one core at a time when you are doing computation of any kind. With Modin, you are able to use all of the CPU cores on your machine. Even with a traditionally synchronous task like read_csv, we see large speedups by efficiently distributing the work across your entire machine.

import modin.pandas as pd

df = pd.read_csv("my_dataset.csv")

Modin can handle the datasets that pandas can't

Often data scientists have to switch between different tools for operating on datasets of different sizes. Processing large dataframes with pandas is slow, and pandas does not support working with dataframes that are too large to fit into the available memory. As a result, pandas workflows that work well for prototyping on a few MBs of data do not scale to tens or hundreds of GBs (depending on the size of your machine). Modin supports operating on data that does not fit in memory, so that you can comfortably work with hundreds of GBs without worrying about substantial slowdown or memory errors. With cluster and out of core support, Modin is a DataFrame library with both great single-node performance and high scalability in a cluster.

Modin Architecture

We designed Modin's architecture to be modular so we can plug in different components as they develop and improve:

Modin's architecture

Other Resources

Getting Started with Modin

Modin Community

Learn More about Modin

Getting Involved

modin.pandas is currently under active development. Requests and contributions are welcome!

For more information on how to contribute to Modin, check out the Modin Contribution Guide.

License

Apache License 2.0

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modin-0.13.0.tar.gz (588.2 kB view details)

Uploaded Source

Built Distribution

modin-0.13.0-py3-none-any.whl (772.4 kB view details)

Uploaded Python 3

File details

Details for the file modin-0.13.0.tar.gz.

File metadata

  • Download URL: modin-0.13.0.tar.gz
  • Upload date:
  • Size: 588.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for modin-0.13.0.tar.gz
Algorithm Hash digest
SHA256 c8e21f64643228b700c6b6fed864f58f86c7d138c4f804f30fca089460962471
MD5 0a6e6bb5d53127060234d63eb14f3c71
BLAKE2b-256 17224ce490bbbfbe595b5284d5aaec5ae428efba7a997ec91c017cfeb83f88e1

See more details on using hashes here.

File details

Details for the file modin-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: modin-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 772.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for modin-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f0472a75f96468faf8edc8212181d7bacf7bf85f0b4de22ba56b1d0eb74863a
MD5 4b36334d327c04def85fc1bb173c9560
BLAKE2b-256 9b95d8a7252ce012348c843202004c168bdb8087c86c016d37536420d7e1c89c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page