File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ pandas 0.13
183183 with datetimes (:issue: `4532 `)
184184 - Fix arithmetic with series/datetimeindex and ``np.timedelta64 `` not working the same (:issue: `4134 `)
185185 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
186187
187188pandas 0.12
188189===========
Original file line number Diff line number Diff line change 5555 def isidentifier (s ):
5656 return s .isidentifier ()
5757
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' )
6060
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' )
6363
6464 # have to explicitly put builtins into the namespace
6565 range = range
Original file line number Diff line number Diff line change 11""" io on the clipboard """
2+ from pandas import compat , get_option
23from pandas .compat import StringIO
34
45def read_clipboard (** kwargs ): # pragma: no cover
@@ -15,6 +16,13 @@ def read_clipboard(**kwargs): # pragma: no cover
1516 from pandas .util .clipboard import clipboard_get
1617 from pandas .io .parsers import read_table
1718 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
1826 return read_table (StringIO (text ), ** kwargs )
1927
2028
You can’t perform that action at this time.
0 commit comments