human
I am working on the file "Assignment+3_Hui+Lyu.ipynb".
The first task is:
Below, construct a dataset class.  You will see stub functions.  You may reuse what we have worked on in class, or you may develop something new.
You must implement the routines convert, columns, filter_eq, filter_lt, filter_gt, filter_ne, size and split.
Can you write Python program for it?
assistant
#Here we have worked on in class, or you may develop something new.

class Dataset:
    def __init__(self, data):
        self.data = data.copy()
        
    def convert(self, column, dtype):
        # YOUR CODE HERE
        self.data[column] = np.array(self.data[column], dtype=dtype)
        #raise NotImplementedError()
        
    def columns(self):
        # YOUR CODE HERE
        return self.data.keys()
        #raise NotImplementedError()
    
    def filter_eq(self, column, value):
        # YOUR CODE HERE
        good = (self.data[column] == value)
        new_data = {}
        for column in self.data:
            new_data[column] = self.data[column][good]
        return Dataset(new_data)
        #raise NotImplementedError()
    
    def filter_lt(self, column, value):
        # YOUR CODE HERE
        good = (self.data[column] < value)
        new_data = {}
        for column in self.data:
            new_data[column] = self.data[column][good]
        return Dataset(new_data)
        #raise NotImplementedError()
    
    def filter_gt(self, column, value):
        # YOUR CODE HERE
        good = (self.data[column] > value)
        new_data = {}
        for column in self.data:
            new_data[column] = self.data[column][good]
        return Dataset(new_data)
        #raise NotImplementedError()
    
    def filter_ne(self, column, value):
        # YOUR CODE HERE
        good = (self.data[column] != value)
        new_data = {}
        for column in self.data:
            new_data[column] = self.data[column][good]
        return Dataset(new_data)
        #raise NotImplementedError()
    
    def size(self):
        # YOUR CODE HERE
        for key in self.data:
            return self.data[key].size
        #raise NotImplementedError()

    def split(self, column):
        # YOUR CODE HERE
        new_datasets = {}
        for split_value in np.unique(self.data[column]):
            new_datasets[split_value] = self.filter_eq(column, split_value)
        return new_datasets
        #raise NotImplementedError()

    def stats(self):
        statistics = {}
       ...