Read CSV With Different Separator Into Pandas

Python

In order to change what Pandas uses as a separator when reading a csv into a dataframe then use the sep parameter.

In the example below we are importing a csv with the separator set to be a forward slash rather the default comma.

 1|  import pandas as pd
 2|  
 3|  df = pd.read_csv('sales_data.csv', sep='/')
Did you find this snippet useful?

Sign up for free to to add this to your code library