From c886eb55c782e60f4ae5b9880ea1b6e34159682e Mon Sep 17 00:00:00 2001 From: Andrew Duberstein Date: Fri, 17 Jan 2020 14:49:46 -0800 Subject: [PATCH] Remove unused code --- .../pydeck/data_utils/binary_transfer.py | 38 +------------------ .../pydeck/pydeck/data_utils/type_checking.py | 11 ------ 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/bindings/pydeck/pydeck/data_utils/binary_transfer.py b/bindings/pydeck/pydeck/data_utils/binary_transfer.py index c0e7cb032dc..60932f4a329 100644 --- a/bindings/pydeck/pydeck/data_utils/binary_transfer.py +++ b/bindings/pydeck/pydeck/data_utils/binary_transfer.py @@ -1,7 +1,5 @@ import numpy as np -from .type_checking import is_pandas_df - # Grafted from # https://github.com/maartenbreddels/ipyvolume/blob/d13828dfd8b57739004d5daf7a1d93ad0839ed0f/ipyvolume/serialize.py#L219 def array_to_binary(ar, obj=None, force_contiguous=True): @@ -36,40 +34,6 @@ def serialize_columns(data_set_cols, obj=None): return payload -def deserialize_columns(value, obj=None): - pass - - -def binary_to_array(value, obj=None): - return np.frombuffer(value["data"], dtype=value["dtype"]).reshape(value["shape"]) - - -def convert_df_to_matrix(df, obj=None, force_contiguous=True): - """ - Flattens a pandas.DataFrame into a row-major format array - - In this implementation, `position` | `color` - - lng | lat | r | g | b - ----+-----+---+---+--- - 0.0 0.0 140 5 5 - -1.0 1.0 100 10 10 - - becomes - - [[0.0, 0.0, 140, 5, 5], [-1.0, 1.0, 100, 10, 10]] - - """ - if df is None or not is_pandas_df(df): - return None - matrix = df.values - try: - return array_to_binary(matrix) - except ValueError as e: - raise Exception("Binary conversion failed with message:", e) - - -array_seralization = dict(to_json=array_to_binary, from_json=None) data_buffer_serialization = dict( - to_json=serialize_columns, from_json=deserialize_columns + to_json=serialize_columns, from_json=None ) diff --git a/bindings/pydeck/pydeck/data_utils/type_checking.py b/bindings/pydeck/pydeck/data_utils/type_checking.py index 7c5aadfdad1..7be594654eb 100644 --- a/bindings/pydeck/pydeck/data_utils/type_checking.py +++ b/bindings/pydeck/pydeck/data_utils/type_checking.py @@ -12,14 +12,3 @@ def is_pandas_df(obj): Returns True if object is a Pandas DataFrame and False otherwise """ return obj.__class__.__module__ == 'pandas.core.frame' and obj.to_records and obj.to_dict - - -def is_numpy_array(obj): - """Check if an object is a numpy array - - Returns - ------- - bool - Returns True if object is a numpy array, False otherwise - """ - return 'numpy.ndarray' in str(obj.__class__) and obj.to_list