运行下列命令生成报表出现以下错误:
E:\SoftWares\Project\log>python conversion_report.py conversion\2017-03-27\conversion.log_2017-03-27T19
Traceback (most recent call last): File "conversion_report.py", line 26, indf[3] = df[1].apply(get_click)
File "C:\Python27\lib\site-packages\pandas\core\series.py", line 2220, in apply
mapped = lib.map_infer(values, f, convert=convert_dtype)
File "pandas\src\inference.pyx", line 1088, in pandas.lib.map_infer (pandas\lib.c:63043)
File "conversion_report.py", line 13, in get_click
for y in x.split(','):
AttributeError: 'float' object has no attribute 'split'
赶紧查看脚本源代码,看到split方法试图分析mapString来迭代使用其中的key和value.
初步判定mapString内容为空,于是使用以下命令检查日志文件:
524 $ grep -n -v -i '@_@{' /E/SoftWares/Project/log/conversion/2017-03-27/conversion.log_2017-03-27T19