|
16 | 16 | from pandas.util.testing import assert_frame_equal |
17 | 17 | from numpy.testing import assert_array_equal |
18 | 18 |
|
19 | | -from pandas.core.reshape import (melt, convert_dummies, lreshape, get_dummies, |
| 19 | +from pandas.core.reshape import (melt, lreshape, get_dummies, |
20 | 20 | wide_to_long) |
21 | 21 | import pandas.util.testing as tm |
22 | 22 | from pandas.compat import StringIO, cPickle, range, u |
@@ -322,34 +322,6 @@ def test_dataframe_dummies_with_categorical(self): |
322 | 322 | 'cat_x', 'cat_y']] |
323 | 323 | assert_frame_equal(result, expected) |
324 | 324 |
|
325 | | - |
326 | | -class TestConvertDummies(tm.TestCase): |
327 | | - def test_convert_dummies(self): |
328 | | - df = DataFrame({'A': ['foo', 'bar', 'foo', 'bar', |
329 | | - 'foo', 'bar', 'foo', 'foo'], |
330 | | - 'B': ['one', 'one', 'two', 'three', |
331 | | - 'two', 'two', 'one', 'three'], |
332 | | - 'C': np.random.randn(8), |
333 | | - 'D': np.random.randn(8)}) |
334 | | - |
335 | | - with tm.assert_produces_warning(FutureWarning): |
336 | | - result = convert_dummies(df, ['A', 'B']) |
337 | | - result2 = convert_dummies(df, ['A', 'B'], prefix_sep='.') |
338 | | - |
339 | | - expected = DataFrame({'A_foo': [1, 0, 1, 0, 1, 0, 1, 1], |
340 | | - 'A_bar': [0, 1, 0, 1, 0, 1, 0, 0], |
341 | | - 'B_one': [1, 1, 0, 0, 0, 0, 1, 0], |
342 | | - 'B_two': [0, 0, 1, 0, 1, 1, 0, 0], |
343 | | - 'B_three': [0, 0, 0, 1, 0, 0, 0, 1], |
344 | | - 'C': df['C'].values, |
345 | | - 'D': df['D'].values}, |
346 | | - columns=result.columns, dtype=float) |
347 | | - expected2 = expected.rename(columns=lambda x: x.replace('_', '.')) |
348 | | - |
349 | | - tm.assert_frame_equal(result, expected) |
350 | | - tm.assert_frame_equal(result2, expected2) |
351 | | - |
352 | | - |
353 | 325 | class TestLreshape(tm.TestCase): |
354 | 326 |
|
355 | 327 | def test_pairs(self): |
|
0 commit comments