Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

DtypeWarning: Columns (7) have mixed types. Specify dtype option on import or set low_memory=False

def convert_dtype(x):
    if not x:
        return ''
    try:
        return str(x)   
    except:        
        return ''

pd.read_csv('file.csv',converters={'first_column': convert_dtype,'second_column': convert_dtype})
Source by www.roelpeters.be #
 
PREVIOUS NEXT
Tagged: #Columns #mixed #Specify #dtype #option #import #set
ADD COMMENT
Topic
Name
6+9 =