예제 #1
0
파일: test_dataframe.py 프로젝트: amrscs/ps
 def test_compute_number_of_spells_simple(self):
     """Test compute_number_of_spells """
     sol = [[1, 1, 1, 1], [1, 1, 2, 2], [1, 2, 3, 4], [1, 1, 2, 2]]
     sol = pd.DataFrame(sol,
                        index=['C1', 'C2', 'C3', 'C4'],
                        columns=['Y1', 'Y2', 'Y3', 'Y4'])
     comp = compute_number_of_spells(self.data)
     assert_frame_equal(comp, sol)
예제 #2
0
	def test_compute_number_of_spells_simple(self):
		"""Test compute_number_of_spells """
		sol = [ 
				[1, 1, 1, 1],
				[1, 1, 2, 2],
				[1, 2, 3, 4],
				[1, 1, 2, 2]
			  ]	
		sol = pd.DataFrame(sol, index=['C1', 'C2', 'C3', 'C4'], columns=['Y1', 'Y2', 'Y3', 'Y4'])
		comp = compute_number_of_spells(self.data)
		assert_frame_equal(comp, sol)
예제 #3
0
	def test_compute_number_of_spells_wnan(self):
		"""Test compute_number_of_spells with np.nan"""
		data = self.data.copy(deep=True) 
		data['Y2'] = np.nan
		sol = [ 
				[1, np.nan, 1, 1], 		#Is this the right behaviour? 1 Isn't a uniquely different item but it also isn't continuous!
				[1, np.nan, 2, 2],
				[1, np.nan, 2, 3],
				[1, np.nan, 2, 2]
			  ]	
		sol = pd.DataFrame(sol, index=['C1', 'C2', 'C3', 'C4'], columns=['Y1', 'Y2', 'Y3', 'Y4'])
		comp = compute_number_of_spells(data)
		assert_frame_equal(comp, sol, check_dtype=False)
예제 #4
0
파일: test_dataframe.py 프로젝트: amrscs/ps
 def test_compute_number_of_spells_wnan(self):
     """Test compute_number_of_spells with np.nan"""
     data = self.data.copy(deep=True)
     data['Y2'] = np.nan
     sol = [
         [
             1, np.nan, 1, 1
         ],  #Is this the right behaviour? 1 Isn't a uniquely different item but it also isn't continuous!
         [1, np.nan, 2, 2],
         [1, np.nan, 2, 3],
         [1, np.nan, 2, 2]
     ]
     sol = pd.DataFrame(sol,
                        index=['C1', 'C2', 'C3', 'C4'],
                        columns=['Y1', 'Y2', 'Y3', 'Y4'])
     comp = compute_number_of_spells(data)
     assert_frame_equal(comp, sol, check_dtype=False)