-
Book Overview & Buying
-
Table Of Contents
GPU-Accelerated Computing with Python 3 and CUDA
By :
cuDF aims to mirror the pandas API as closely as possible. In most cases, the following pattern that was introduced in Chapter 8 works:
import pandas as pd
try:
import cudf as xd
CUDF_IS_INSTALLED = True
except ImportError:
xd = pd
CUDF_IS_INSTALLED = False
However, cuDF is not an exact replacement for pandas. Not all functions, arguments, and options have been implemented. If a code base relies on more exotic pandas functionality, cuDF may not replace it.
For these cases, there is cudf.pandas. This cudf.pandas keeps a pandas code base entirely unchanged. The operations that are supported by cuDF will automatically run on the GPU. Operations that are not supported by cuDF will fall back to pandas automatically. The only requirement is that the following lines are added to the code before importing or using pandas:
import cudf.pandas
cudf.pandas.install()
In a Jupyter notebook, the following line should be run at the...