Skip to content

cannot safely convert passed user dtype of <f8 for object dtyped data in column *** #13237

Closed
@wildwild

Description

@wildwild

Code Sample, a copy-pastable example if possible

under 64bit windows problem

it's ok on win32 platform ,but it does not work under 64bit,unless I remove the dtype and read the DataFrame and then transform the format asfloat ...

I cant debug into the file

market_head_list = ['TradingDay','ClosePrice']
dt['TradingDay'] = np.str
dt['ClosePrice'] = float # I used np.float64 too ,but it still cant work
csv_str_now ='1.7976931348623157e+308, 1.7976931348623157e+308 '

csv_str = StringIO.StringIO((csv_str_now))

df = pd.read_csv(csv_str, engine='c', names=market_head_list,dtype=dt)

output of pd.show_versions()

pandas: 0.18.1
nose: 1.3.7
pip: 8.1.2
setuptools: 20.3
Cython: 0.23.4
numpy: 1.11.0
scipy: 0.17.0
statsmodels: None
xarray: None
IPython: 4.1.2
sphinx: 1.3.5
patsy: 0.4.0
dateutil: 2.5.1
pytz: 2016.2
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.5.2
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.8.4
lxml: 3.6.0
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.39.0
pandas_datareader: None

File "pandas\parser.pyx", line 805, in pandas.parser.TextReader.read (pandas\parser.c:8620)
File "pandas\parser.pyx", line 827, in pandas.parser.TextReader._read_low_memory (pandas\parser.c:8876)
File "pandas\parser.pyx", line 904, in pandas.parser.TextReader._read_rows (pandas\parser.c:9893)
File "pandas\parser.pyx", line 1011, in pandas.parser.TextReader._convert_column_data (pandas\parser.c:11286)
File "pandas\parser.pyx", line 1092, in pandas.parser.TextReader._convert_tokens (pandas\parser.c:12659)
ValueError: cannot safely convert passed user dtype of <f8 for object dtyped data in column 1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions