Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csvcut issue with Python 3 #302

Closed
bucweat opened this issue Aug 11, 2014 · 3 comments
Closed

csvcut issue with Python 3 #302

bucweat opened this issue Aug 11, 2014 · 3 comments
Labels

Comments

@bucweat
Copy link

bucweat commented Aug 11, 2014

Hi,

Was going through the "Examining Data" section of the tutorial. The section "2.5. Sorting with csvsort" command "" works with Python 2, but not with Python 3. From my terminal:

************* Python 2 **************
charlies-MacBook-Air:va_benefits charlie$ csvcut -c 9,1 2009.csv | csvsort -r | head -n 5
TOTAL,State Name
,
46897,CALIFORNIA
40402,TEXAS
36394,FLORIDA
charlies-MacBook-Air:va_benefits charlie$ python --version
Python 2.7.6 :: Anaconda 2.0.0 (x86_64)

************* Python 3 **************
(py3k)charlies-MacBook-Air:va_benefits charlie$ csvcut -c 9,1 2009.csv | csvsort -r | head -n 5
unorderable types: int() < str()
(py3k)charlies-MacBook-Air:va_benefits charlie$ python --version
Python 3.3.5 :: Anaconda 2.0.0 (x86_64)

I've not had a chance to troubleshoot a whole lot...figured I'd toss this one out there and see if this is a known problem or not. Column 9 in this data set is mostly quoted values with embedded commas (e.g. ...,"45,456",...).

charlie

@JoeGermuska
Copy link
Contributor

Can provide the problem CSV? Or if not, can you make a simple one that demonstrates the problem?

@onyxfish
Copy link
Collaborator

onyxfish commented Sep 5, 2014

Replicated:

csvcut -c 9,1 examples/realdata/FY09_EDU_Recipients_by_State.csv | csvsort -r | head -n 5

@onyxfish
Copy link
Collaborator

onyxfish commented Sep 5, 2014

Traceback from csvsort:

Traceback (most recent call last):
  File "/Users/onyxfish/.virtualenvs/csvkit3/bin/csvsort", line 9, in <module>
    load_entry_point('csvkit==0.8.1', 'console_scripts', 'csvsort')()
  File "/Users/onyxfish/src/csvkit/csvkit/utilities/csvsort.py", line 59, in launch_new_instance
    utility.main()
  File "/Users/onyxfish/src/csvkit/csvkit/utilities/csvsort.py", line 48, in main
    rows.sort(key=sorter, reverse=self.args.reverse)
TypeError: unorderable types: int() < str()

lcorbasson pushed a commit to lcorbasson/csvkit that referenced this issue Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants