DEV Community

Discussion on: How do you debug a Python script that crashes Python itself?

Collapse
 
ktechlearn profile image
KT TechLearn

Hi , I tried to understand and facing some doubts about error which getting during execution.

Below is my dtypes :

age int64
sex object
bmi float64
children int64
smoker object
region object
expenses float64
dtype: object

Index(['age', 'bmi', 'children', 'expenses', 'sex_female', 'sex_male',
'smoker_no', 'smoker_yes', 'region_northeast', 'region_northwest',
'region_southeast', 'region_southwest'],
dtype='object')

Error : ValueError: could not convert string to float: 'male'

Question/Query : I am not able to understand why programme is trying to convert object or string into float data type. What is the need to perform conversion here.

Thread Thread
 
jmfayard profile image
Jean-Michel (jmfayard.dev)

The odd that you find a specialist of your problem at hand here is very slim.
This kind of super focused question work better at stackoverflow.com/