File tree 2 files changed +7
-1
lines changed
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 16
16
import numpy as np
17
17
18
18
from pandas import DataFrame , Series , Index
19
+ from pandas .util .py3compat import lzip
19
20
import pandas .core .format as fmt
20
21
import pandas .util .testing as tm
21
22
import pandas
@@ -178,7 +179,7 @@ def test_to_string_with_formatters(self):
178
179
('float' , lambda x : '[% 4.1f]' % x ),
179
180
('object' , lambda x : '-%s-' % str (x ))]
180
181
result = df .to_string (formatters = dict (formatters ))
181
- result2 = df .to_string (formatters = zip (* formatters )[1 ])
182
+ result2 = df .to_string (formatters = lzip (* formatters )[1 ])
182
183
self .assertEqual (result , (' int float object\n '
183
184
'0 0x1 [ 1.0] -(1, 2)-\n '
184
185
'1 0x2 [ 2.0] -True-\n '
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ def str_to_bytes(s, encoding='ascii'):
12
12
def bytes_to_str (b , encoding = 'utf-8' ):
13
13
return b .decode (encoding )
14
14
15
+ lzip = lambda * args : list (zip (* args ))
15
16
else :
16
17
# Python 2
17
18
import re
@@ -26,6 +27,8 @@ def str_to_bytes(s, encoding='ascii'):
26
27
def bytes_to_str (b , encoding = 'ascii' ):
27
28
return b
28
29
30
+ lzip = zip
31
+
29
32
try :
30
33
from cStringIO import StringIO
31
34
except :
@@ -35,3 +38,5 @@ def bytes_to_str(b, encoding='ascii'):
35
38
from io import BytesIO
36
39
except :
37
40
from cStringIO import StringIO as BytesIO
41
+
42
+
You can’t perform that action at this time.
0 commit comments