We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 99a81f9 commit e96495fCopy full SHA for e96495f
pandas/tests/sparse/frame/test_frame.py
@@ -156,6 +156,15 @@ def test_constructor_ndarray(self, float_frame):
156
SparseDataFrame(float_frame.values,
157
columns=float_frame.columns[:-1])
158
159
+ def test_construct_unmatched_sparsedataframe(self, float_frame):
160
+ # GH25484
161
+ dates = pd.bdate_range('1/1/2011', periods=10)
162
+ sp = SparseDataFrame(float_frame.values, index=dates)
163
+ N = len(sp)
164
+ msg = 'Length of values does not match length of index'
165
+ with pytest.raises(ValueError, match=msg):
166
+ sp['foo'] = np.random.randn(N-1)
167
+
168
# GH 9272
169
def test_constructor_empty(self):
170
sp = SparseDataFrame()
0 commit comments