csvkit: csvstat gives me "'NoneType' object has no attribute 'decimal_formats'" error for tutorial data

Whenever I try csvstat for the tutorial data, I get the following error and it just stops wherever it detects the error

$ csvstat data.csv

  1. "state"

        Type of data:          Text
        Contains null values:  False
        Unique values:         1
        Most common values:    NE (1036x)

  2. "county"

        Type of data:          Text
        Contains null values:  False
        Unique values:         35
        Most common values:    DOUGLAS (760x)
                               DAKOTA (42x)
                               CASS (37x)
                               HALL (23x)
                               LANCASTER (18x)

  3. "fips"

        Type of data:          Number
        Contains null values:  False
        Unique values:         35
'NoneType' object has no attribute 'decimal_formats'
        Most common values:   

My environment:

OS X 10.11.6

python version : 2.7.10

pip version : 9.0.1

I installed csvkit via pip yesterday (Apr 8th)

Any idea?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 27 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Sweet! I can confirm that 1.0.3 solves this issue, at least on my side: sudo pip install --ignore-installed git+https://github.com/wireservice/csvkit.git@master

If anyone else is having the same issue with 1.0.2 and running macOS using system’s Python, it is worth noting that only using pip install --ignore-installed git+https://github.com/wireservice/csvkit.git@master will install csvkit, but not solve the issue - probably because pip install in this case won’t have access to the Python library.

@jpmckinney Thank you for fixing this issue!

On macOS I would recommend not using the system’s Python, and instead use Python installed by Homebrew. The system Python causes many problems.

I personally do:

brew install pyenv
pyenv install 3.6.1
pyenv global 3.6.1

@bekicot FYI: The suggested work-around does not return all expected output values:

Specifically, csvstat input --csv does not return mean, max, sum, mean, median, stdev, len.

$ csvcut -c county,acquisition_cost,ship_date out.csv | csvstat --csv column_id,column_name,type,nulls,unique,min,max,sum,mean,median,stdev,len,freq 1,county,Text,False,35,“DOUGLAS, DAKOTA, CASS, HALL, LANCASTER” 2,acquisition_cost,Number,False,75,“6800.0, 10747.0, 6000.0, 499.0, 0.0” 3,ship_date,Date,False,84,2006-03-07,2014-01-30,“2013-04-25, 2013-04-26, 2008-05-20, 2012-04-16, 2006-11-17”

$ csvstat acs2012_5yr_population.csv --csv column_id,column_name,type,nulls,unique,min,max,sum,mean,median,stdev,len,freq 1,fips,Number,False,93,“31001, 31003, 31005, 31007, 31009” 2,name,Text,False,93,“Adams County, NE, Antelope County, NE, Arthur County, NE, Banner County, NE, Blaine County, NE” 3,total_population,Number,False,93,“31299, 6655, 490, 778, 584” 4,margin_of_error,Number,False,15,“0, 73, 114, 97, 99”