python-碰到的问题

来源:互联网 发布:大数据技术经典书籍 编辑:程序博客网 时间:2024/04/29 15:30

1、pandas.read_csv()函数,读取文件数据时,由于分隔符为'::',弹出如下警告

       警告:ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex)

       解决方法:增加函数的引擎参数engine='python',如下:

header = ['user_id', 'item_id', 'rating', 'timestamp']df = pd.read_csv("D:/ratings.dat", sep='::', names=header,engine='python')

原创粉丝点击