pandas read_csv()出错

Error tokenizing data. C error: Expected 1 fields in line 4, saw 2

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

df = pd.read_csv("D:\\py_data\\py_study\\machine_learning\\data.csv")
print(df)

不知道为啥报错....

  • name gender age score
  • a male 18 80
  • b female 18 81
  • c male 18 82
  • d female 17 83
  • e male 17 84
  • f female 17 85
  • g male 16 86
  • h female 16 87
  • i male 16 88
  • j female 15 89

贴出你的csv看看
你的csv存在空行或者某一行缺少数据的情况。