from dask.context import config import dask.dataframe as dd import numpy as np import pandas as pd import xarray as xr import datashader as ds import pytest config.set(scheduler='synchronous') df = pd.DataFrame({'x': np.array(([0.] * 10 + [1] * 10)), 'y': np.array(([0.] * 5 + [1] * 5 + [0] * 5 + [1] * 5)), 'log_x': np.array(([1.] * 10 + [10] * 10)), 'log_y': np.array(([1.] * 5 + [10] * 5 + [1] * 5 + [10] * 5)), 'i32': np.arange(20, dtype='i4'), 'i64': np.arange(20, dtype='i8'), 'f32': np.arange(20, dtype='f4'), 'f64': np.arange(20, dtype='f8'), 'empty_bin': np.array([0.] * 15 + [np.nan] * 5), 'cat': ['a']*5 + ['b']*5 + ['c']*5 + ['d']*5}) df.cat = df.cat.astype('category') df.f32[2] = np.nan df.f64[2] = np.nan ddf = dd.from_pandas(df, npartitions=3) c = ds.Canvas(plot_width=2, plot_height=2, x_range=(0, 1), y_range=(0, 1)) c_logx = ds.Canvas(plot_width=2, plot_height=2, x_range=(1, 10), y_range=(0, 1), x_axis_type='log')
from __future__ import division from dask.context import config import dask.dataframe as dd import numpy as np import pandas as pd import xarray as xr import datashader as ds import datashader.utils as du import pytest config.set(scheduler='synchronous') df = pd.DataFrame({ 'x': np.array(([0.] * 10 + [1] * 10)), 'y': np.array(([0.] * 5 + [1] * 5 + [0] * 5 + [1] * 5)), 'log_x': np.array(([1.] * 10 + [10] * 10)), 'log_y': np.array(([1.] * 5 + [10] * 5 + [1] * 5 + [10] * 5)), 'i32': np.arange(20, dtype='i4'), 'i64': np.arange(20, dtype='i8'), 'f32': np.arange(20, dtype='f4'), 'f64': np.arange(20, dtype='f8'), 'empty_bin': np.array([0.] * 15 + [np.nan] * 5), 'cat': ['a'] * 5 + ['b'] * 5 + ['c'] * 5 + ['d'] * 5 }) df.cat = df.cat.astype('category') df.f32[2] = np.nan df.f64[2] = np.nan ddf = dd.from_pandas(df, npartitions=3)
from dask.local import get_sync from dask.context import config import dask.dataframe as dd import numpy as np import pandas as pd import xarray as xr import datashader as ds import pytest config.set(scheduler=get_sync) df = pd.DataFrame({ 'x': np.array(([0.] * 10 + [1] * 10)), 'y': np.array(([0.] * 5 + [1] * 5 + [0] * 5 + [1] * 5)), 'log_x': np.array(([1.] * 10 + [10] * 10)), 'log_y': np.array(([1.] * 5 + [10] * 5 + [1] * 5 + [10] * 5)), 'i32': np.arange(20, dtype='i4'), 'i64': np.arange(20, dtype='i8'), 'f32': np.arange(20, dtype='f4'), 'f64': np.arange(20, dtype='f8'), 'empty_bin': np.array([0.] * 15 + [np.nan] * 5), 'cat': ['a'] * 5 + ['b'] * 5 + ['c'] * 5 + ['d'] * 5 }) df.cat = df.cat.astype('category') df.f32[2] = np.nan df.f64[2] = np.nan ddf = dd.from_pandas(df, npartitions=3)