How to import a .csv from your clipboard with Python pandas

--

Your colleague sends you a .csv file in slack and wants you to do some quick transformations on it.

Good news! You don’t have to save these .csv files to your machine, get the file path, and load it into a pandas data frame.

There’s an easier way!

It’s called pandas.read_clipboard()

How to use pandas read_clipboard()

For this example, your colleague sends you this .csv in slack with housing data. He’d like it sorted from largest to small by bedrooms.

homes_sorted.csv

Here is what the original .csv file looks like

Import data using read_clipboard()

Copy .csv to clipboard here: homes_sorted.csv

homes_sorted_by_bedroom.csv

Credits: https://www.usepandas.com/

#datascience #pandas #python

--

--

No responses yet