Search code examples
pythonpandascsvdatasetdelimiter

how i convert csv using pandas with a lot of delimiter


My dataset (national income):

dataset national income

How can I find what delimiter is for my dataset, because I try to read my dataset csv file using pandas libraries but I already try a comma (,), a semicolon (;), a tab (\t), a space ( ) and a pipe (|) but it still didn't work. I also try df=pd.read_csv("file name", sep='delimiter') but it still didn't work. Is there someone help me, what should I do?


Solution

  • Either remove the first four rows of the dataset as they aren't relevant and save the CSV then everything will work fine in pandas after using , as delimiter OR use skiprows as while reading the CSV:

    df = pd.read_csv("net_national_income.csv", skiprows = 4)