89894

What is the difference between `sep` and `delimiter` attributes in pandas.read_csv() method?

Question:

What is the difference between sep and delimiter attributes in pandas.read_csv() method?

Also what is the situation when I would choose one over the other?

In documentation I read something about Python builtin sniffer tool, also in delimiter, it says <em>alternative argument name for sep</em>, then why cant we have only one attribute?

Answer1:

Confirmation that they are the same thing can be found in the <a href="https://github.com/pandas-dev/pandas/blob/master/pandas/io/parsers.py" rel="nofollow">source code</a>:

# Alias sep -> delimiter. if delimiter is None: delimiter = sep

I agree with the other answer that it is best to stick to sep. It seems to be more commonly used, and it is more consistent with other functions such as <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_csv.html" rel="nofollow">to_csv</a>, which does not accept delimiter, only sep.

Answer2:

They're the same thing. See <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html" rel="nofollow">here</a>.

I assume one is for backwards compatibility. I'd just use sep, it's what I see the most.

Recommend

  • URLDownloadToFile fails with code 0x800c0008 (INET_E_DOWNLOAD_FAILURE)
  • Paramiko skipping some data on channel recv
  • how to apply a function on every column of a data?
  • php sorter script only outputting the same data even though i am asking it to do diffrent
  • Read File headers and delimiters using Python
  • FParsec: how to parse date in fparsec (newbie)
  • How to get localized Windows Administrators group name in Inno Setup?
  • Strange file-permissions if apps run as administrator
  • VBA, TRIM part of a Path
  • Windows Phone 7 sniffer
  • Why won't EF4 generate a method to support my Function Import?
  • How to get the index of element in the List in c#
  • command line of process by name
  • Primefaces lazy datascroller calling load twice
  • Click on button in another program - FindWindow, C#
  • VSCode change debug shell to bash on windows
  • import scipy.sparse failed
  • SyntaxError: (irb):26: both block arg and actual block given
  • Does Apple allow the usage of sysctl.h within iOS applications?
  • How do I display a dialog that asks the user multi-choice questıon using tkInter?
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • where do I find the xml.dom python package for the python-2.6.0-8.9.28 and I have a suse/x86_64 vers
  • Python pickle not one-to-one: different pickles give same object
  • d3 v4 drag and drop with TypeScript
  • Moving mysql files across servers
  • Why does access(2) check for real and not effective UID?
  • Scrapy recursive link crawler
  • How to rebase a series of branches?
  • Illegal mix of collations for operation for date/time comparison
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Java applet as stand-alone Windows application?
  • Jquery - Jquery Wysiwyg return html as a string
  • Return words with double consecutive letters
  • R: gsub and capture
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • SQL merge duplicate rows and join values that are different
  • LevelDB C iterator
  • Linking SubReports Without LinkChild/LinkMaster
  • Can't mass-assign protected attributes when import data from csv file
  • Reading document lines to the user (python)