예제 #1
0
def test_normalize4():
	testing_df = df.copy()
	with pytest.raises(Exception):
		clean.normalize(testing_df, 20, 0 , 18)
예제 #2
0
def test_normalize2():
	testing_df = df.copy()
	result_df = df.copy()
	clean.normalize(testing_df, 1, -3 , -18)
	result_df['col2'] = -3 + ((result_df['col2'] - result_df['col2'].min()) * (-18 - (-3))) / (result_df['col2'].max() - result_df['col2'].min())
	assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True
예제 #3
0
def test_normalize3():
	testing_df = df.copy()
	testing_df['col4'] = pd.Series([1, 1, 1], index = [0, 1, 2])
	result_df = testing_df.copy()
	clean.normalize(testing_df, 3, 0 , 18)
	assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True
예제 #4
0
def test_normalize1():
	testing_df = df.copy()
	result_df = df.copy()
	clean.normalize(testing_df, 1, 0 ,18)
	result_df['col2'] = 0 + ((result_df['col2'] - result_df['col2'].min()) * (18 - 0)) / (result_df['col2'].max() - result_df['col2'].min())
	assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True