4 ms·
It's `pandas.read_<format> -> DataFrame` and `DataFrame.to_<format>`. So pandas reads a data format and gives you a dataframe. The `to_<format>` are instane met
by efxhoy 6y ago
It's `pandas.read_<format> -> DataFrame` and `DataFrame.to_<format>`. So pandas reads a data format and gives you a dataframe. The `to_<format>` are instane methods of the DataFrame where you write a dataframe to a format. To me that makes sense.
- mft_ 6y agoSure, you can create a sort-of logic to fit the existing naming, but it's still something you have to learn. Imagine you were using Pandas for the first time, working through a tutorial, and you've just learned that pd.read_csv reads a csv into a dataframe. Intuitively, what would you expect the corresponding output function to be called? I'd hazard that a vast majority of people would guess at some version of write_csv, and would experiment with either pd.write_csv, or df.write_csv.