Keep (un-deprecate) `read_table()` for API stability
See original GitHub issueProblem description
read_table()
got deprecated in favour of using read_csv()
.
Using read_csv()
to read tab/space delimited files is counter-intuitive. According to the docs and the related issues, both share the same code and it is not clear why the one function should be preferred over the other, and that change may even break existing code.
In my point of view read_table()
is the more general function and read_csv()
is a special case. Why would you deprecate (and then remove) the more useful function? It is already annoying to use to_csv()
to write space/tab delimited files. And as I can see it, it comes down to two lines of code.
Proposed solution
Keep both functions as they are (un-deprecate read_table()
) or rename the function to have a more general name like read_txt()
(as in numpy.genfromtxt()
) or similar.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:34 (20 by maintainers)
Add my vote to keeping
read_table
around!I’ve been a pandas user for 7+ years and have used
read_table(...,sep="\t")
where necessary. I agree with OP that I far prefer theread_table
form as it sounds more general.I will note that the documentation supports this interpretation:
read_table
is a function to “Read general delimited file into DataFrame.” whileread_csv
is to “Read a comma-separated values (csv) file into DataFrame.”I have to say in my corner of datasciences, no one has touched the standard csv module, while everyone uses pandas, so I think it should decide for itself what’s right. (A better point of comparison is probably R, which has both a
read.csv
andread.table
function, whereread.csv
is an alias for the more general-purposeread.table
.)I generally agree with minimizing aliases, but this is at the core of what pandas does and is a very widespread alias. While “pd.read_csv” is clearly more commonly used – I wouldn’t suggest getting rid of it! – a quick unscientific github search yields 50k+ results for “pd.read_table”.
Hi, Thank you for your input and setting the labels and sorry for getting back to you so late. I am not really sure that I understood correctly, my point is that #18262 only lists a number of API functions to be deprecated, i.e. to be removed in the future, without further reasoning. In my opinion any change to the official and documented API should be justified. After all,
pandas
calls itself stable.Note that I am not really opposed to keeping both functions, so the title may be a little provocative and could be adjusted.
My points pro keeping
read_table()
:read_table()
to read ascii files with any delimiter/separator overread_csv()
with the connotation of a fixed delimiter, the comma. Renaming that function toread_txt()
may be worthwhile considering, although it contradicts the first point above.Contra (as far as I can see):