Re: Pound sign problem

2017-04-11 Thread Mikhail V
On 10 April 2017 at 15:17, David Shi via Python-list wrote: > In the data set, pound sign escape appears: > u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000', > When using table.to_csv after importing pandas as pd, an error message > persists as follows: >

Re: Pound sign problem

2017-04-11 Thread Tim Chase
On 2017-04-12 02:29, Steve D'Aprano wrote: > >> In 2017, unless you are reading from old legacy files created > >> using a non-Unicode encoding, you should just use UTF-8. > > > > Thanks for your opinion. My opinion differs. > > What would you suggest then, if not UTF-8? > > My personal

Re: Pound sign problem

2017-04-11 Thread Steve D'Aprano
On Wed, 12 Apr 2017 02:23 am, Lew Pitcher wrote: > I recommend whatever encoding is appropriate for the output. There are multiple encodings that are appropriate for ASCII + pound sign. How should the OP choose between them without guidance? If he understood the issue well enough to make an

Re: Pound sign problem

2017-04-11 Thread Chris Angelico
On Wed, Apr 12, 2017 at 2:23 AM, Lew Pitcher wrote: > Chris Angelico wrote: > >> On Wed, Apr 12, 2017 at 1:24 AM, Lew Pitcher >> wrote: >>> >>> What in "Try changing your target encoding to something other than ASCII" >>> is

Re: Pound sign problem

2017-04-11 Thread Steve D'Aprano
On Wed, 12 Apr 2017 01:24 am, Lew Pitcher wrote: [...] >>> There is no "pound sign" in ASCII[1]. Try changing your target encoding >>> to something other than ASCII. >> >> Please don't encourage the use of old legacy encodings. > > I wonder if you actually read my reply. Of course I did. >

Re: Pound sign problem

2017-04-11 Thread Lew Pitcher
Chris Angelico wrote: > On Wed, Apr 12, 2017 at 1:24 AM, Lew Pitcher > wrote: >> >> What in "Try changing your target encoding to something other than ASCII" >> is encouragement to use "old legacy encodings"? >> >>> In 2017, unless you are reading from old legacy

Re: Pound sign problem

2017-04-11 Thread Chris Angelico
On Wed, Apr 12, 2017 at 1:24 AM, Lew Pitcher wrote: > > What in "Try changing your target encoding to something other than ASCII" is > encouragement to use "old legacy encodings"? > >> In 2017, unless you are reading from old legacy files created using a >>

Re: Pound sign problem

2017-04-11 Thread Lew Pitcher
Steve D'Aprano wrote: > On Tue, 11 Apr 2017 12:50 am, Lew Pitcher wrote: > >> David Shi wrote: >> >>> In the data set, pound sign escape appears: >>> u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000', > > That looks like David is using Python 2. > >>> When using table.to_csv

Re: Pound sign problem

2017-04-10 Thread Steve D'Aprano
On Tue, 11 Apr 2017 12:50 am, Lew Pitcher wrote: > David Shi wrote: > >> In the data set, pound sign escape appears: >> u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000', That looks like David is using Python 2. >> When using table.to_csv after importing pandas as pd, an error

Re: Pound sign problem

2017-04-10 Thread Lew Pitcher
David Shi wrote: > In the data set, pound sign escape appears: > u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000', > When using table.to_csv after importing pandas as pd, an error message > persists as follows: UnicodeEncodeError: 'ascii' codec can't encode > character u'\xa3' in

Re: Pound sign problem

2017-04-10 Thread Peter Otten
David Shi via Python-list wrote: > In the data set, pound sign escape appears: > u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000', > When using table.to_csv after importing pandas as pd, an error message > persists as follows: UnicodeEncodeError: 'ascii' codec can't encode >

Re: Pound sign problem

2017-04-10 Thread Ben Finney
David Shi via Python-list writes: > When using table.to_csv after importing pandas as pd I don't know much about that library. What does its documentation say for the ‘table.to_csv’ function? Can you write a *very short* complete example, that we can run to demonstrate

Pound sign problem

2017-04-10 Thread David Shi via Python-list
In the data set, pound sign escape appears: u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000', When using table.to_csv after importing pandas as pd, an error message persists as follows: UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 0: ordinal not in