Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions drawdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ def data_as_polars(self):
def data_as_X_y(self):
import numpy as np

colors = [_['color'] for _ in self.data]
labels = [_['label'] for _ in self.data] # Updated to use 'label' instead of 'color'

# Assume that we're dealing with regression in this case
if np.unique(colors).shape[0] == 1:
if np.unique(labels).shape[0] == 1:
X = np.array([[_['x']] for _ in self.data])
y = np.array([_['y'] for _ in self.data])
return X, y

X = np.array([[_['x'], _['y']] for _ in self.data])
return X, colors
return X, labels


class BarWidget(anywidget.AnyWidget):
Expand Down