Python Day 50 – Pandas practice problems

Today I practiced importing various data into Python with Pandas, and looking at it in different ways.

I learned:

To use the pd.read_csv(“folder/data_name.csv”) command to define a dataset from an outside source. And then use .sort_values(by = ‘category’, ascending = False) to sort the values however I wish.

Also to chart data, use the df3.plot(x = ‘category’, y = ‘category’, kind = ‘scatter/line’) and plt.show() commands to quickly create charts! That was kinda funky.

I am still confused by:

One of the practice datasets was a .txt file. I imported it then exported it as a .csv although the column names were all messed up. They were called ‘unnamed 0,1,2,3…’. I tried exporting with ‘index = False’ however it then didn’t export all the data to a .csv. I’m not sure how to go about deleting these column names and reseting them to different values yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: