def test_print_memory_use(self, mock_print): data = test.data_frame("vehicles.csv") data.print_memory_use() mock_print.assert_called()
def test_ncol(self): data = test.data_frame("vehicles.csv") assert data.ncol == 12
def test_nrow(self): data = test.data_frame("vehicles.csv") assert data.nrow == 33442
def test_modify(self): orig = test.data_frame("vehicles.csv") data = orig.modify(test=1) assert data.nrow == orig.nrow assert data.ncol == orig.ncol + 1 assert np.all(data.test == 1)
def test_modify_function(self): orig = test.data_frame("vehicles.csv") data = orig.modify(test=lambda x: x.make) assert data.nrow == orig.nrow assert data.ncol == orig.ncol + 1 assert np.all(data.test == data.make)
def test_read_npz(self): orig = test.data_frame("vehicles.csv") handle, path = tempfile.mkstemp(".npz") orig.write_npz(path) data = DataFrame.read_npz(path) assert data == orig
def test___setitem__(self): data = test.data_frame("vehicles.csv") assert "test" not in data data["test"] = 1 assert "test" in data
def test_filter_out_given_colname_value_pairs(self): data = test.data_frame("vehicles.csv") data = data.filter_out(make="Saab") assert data.nrow == 33018 assert np.all(data.make != "Saab") assert np.sum(data.hwy) == 776930
def test_from_json(self): orig = test.data_frame("downloads.json") text = orig.to_json() data = DataFrame.from_json(text) assert data == orig
def test_deepcopy(self): orig = test.data_frame("vehicles.csv") data = orig.copy() assert data == orig assert data is not orig
def test_filter_given_colname_value_pairs(self): data = test.data_frame("vehicles.csv") data = data.filter(make="Saab") assert data.nrow == 424 assert np.all(data.make == "Saab") assert np.sum(data.hwy) == 10672
def test_columns(self): data = test.data_frame("downloads.csv") assert data.columns == [data.category, data.date, data.downloads]
def test_colnames_set(self): data = test.data_frame("downloads.csv") data.colnames = ["a", "b", "c"] assert data.colnames == ["a", "b", "c"]
def test_colnames(self): data = test.data_frame("downloads.csv") assert data.colnames == ["category", "date", "downloads"]
def test_print_na_counts(self, mock_print): data = test.data_frame("vehicles.csv") data.print_na_counts() mock_print.assert_called()
def test_head(self): data = test.data_frame("vehicles.csv") assert data.head(10) == data.slice(list(range(10)))
def test_print_na_counts_none(self, mock_print): data = test.data_frame("vehicles.csv") data = data.select("id", "make", "model") data.print_na_counts() mock_print.assert_not_called()
def test_map(self): data = test.data_frame("vehicles.csv") x = data.map(lambda x, i: x.hwy[i]**2) y = [x**2 for x in data.hwy] assert x == y
def test_read_npz_path(self): orig = test.data_frame("vehicles.csv") handle, path = tempfile.mkstemp(".npz") orig.write_npz(path) DataFrame.read_npz(Path(path))
def test___setattr__(self): data = test.data_frame("vehicles.csv") assert "test" not in data data.test = 1 assert "test" in data