What is the Python equivalent to R’s read.csv() function, and the data.frame it returns?
Is there a similar data structure in Python?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your have two elements in your question, (1) reading/writing CSV and (2) an equivalent data structure to the R
data.framethat results from reading in a CSV-file.For the first part, there is the
csvmodule in the standard library.For the second part, the standard library is lacking a equivalent tabular data structure with the flexibility of the the R
data.frame. You have two options, depending on the complexity of the operations you will be doing afterwards:DataFramedata structure in the pandas package. It has similar read/write functions for tabular fileformats, but has indexing/slicing, manipulation, built-in summary operations, etc. simmilar to the the Rdata.frame.