File tree 3 files changed +13
-4
lines changed
3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ pandas 0.13
183
183
with datetimes (:issue: `4532 `)
184
184
- Fix arithmetic with series/datetimeindex and ``np.timedelta64 `` not working the same (:issue: `4134 `)
185
185
and buggy timedelta in numpy 1.6 (:issue: `4135 `)
186
+ - Fix bug in ``pd.read_clipboard `` on windows with PY3 (:issue: `4561 `); not decoding properly
186
187
187
188
pandas 0.12
188
189
===========
Original file line number Diff line number Diff line change 55
55
def isidentifier (s ):
56
56
return s .isidentifier ()
57
57
58
- def str_to_bytes (s , encoding = 'ascii' ):
59
- return s .encode (encoding )
58
+ def str_to_bytes (s , encoding = None ):
59
+ return s .encode (encoding or 'ascii' )
60
60
61
- def bytes_to_str (b , encoding = 'utf-8' ):
62
- return b .decode (encoding )
61
+ def bytes_to_str (b , encoding = None ):
62
+ return b .decode (encoding or 'utf-8' )
63
63
64
64
# have to explicitly put builtins into the namespace
65
65
range = range
Original file line number Diff line number Diff line change 1
1
""" io on the clipboard """
2
+ from pandas import compat , get_option
2
3
from pandas .compat import StringIO
3
4
4
5
def read_clipboard (** kwargs ): # pragma: no cover
@@ -15,6 +16,13 @@ def read_clipboard(**kwargs): # pragma: no cover
15
16
from pandas .util .clipboard import clipboard_get
16
17
from pandas .io .parsers import read_table
17
18
text = clipboard_get ()
19
+
20
+ # try to decode (if needed on PY3)
21
+ if compat .PY3 :
22
+ try :
23
+ text = compat .bytes_to_str (text ,encoding = kwargs .get ('encoding' ) or get_option ('display.encoding' ))
24
+ except :
25
+ pass
18
26
return read_table (StringIO (text ), ** kwargs )
19
27
20
28
You can’t perform that action at this time.
0 commit comments