在处理时间数据的时候,由于洗数据不干净,出现了这个问题
ValueError:could not convert string to float: '11h 30m'
但是只需加上这段代码就可以运行了
flights['Duration']=flights['Duration'].str.replace('h','*60').str.replace(' ','+').str.replace('m','*1').apply(eval)
这样时间数据就可以变成这个模式了