Python Day 52 – importing data into Pandas

Again, it took literally 2 seconds of me looking at my problem of the data not importing from yesterday to realize my mistake… if only all of life’s answers could become clear upon one night’s sleep.

I learned:

THAT ONE NEEDS TO PUT “foldername/data.csv” WHEN READING A CSV FILE WITH PANDAS. THIS WAS LITERALLY WRITTEN DIRECTLY ABOVE THE LINE THAT I STRUGGLING WITH YESTERDAY YET I SOMEHOW DIDN’T SEE IT. I AM AMAZED AT MY BLINDNESS.

Anywho, also one can use the basic [#:#:#] to call for different rows of the data! For instance, to only see the first ten rows… data[:10].

To find the type of a column, simply put data.column_name.dtype.

To find the names of all the columns, simply put data_name.columns.

To describe the data… well this is where my confusion settled in…

I am still confused on:

The .describe function in its pure (one could say ‘raw’) form outputs a mess of the data that is not in pretty lines like it normally does. Whenever I try to use the function .describe(include=all) I get an error saying:

Cannot interpret ‘<built-in function all>’ as data type

In the documentation it appears one should be able to use ‘all’, so now I am confused. Is it perhaps because my data is a mix of strings and integers?

Additionally, how does one take the mean value of a column? I know it is likely very simple so this shall be a problem I’ll google tomorrow morning to make me feel like I’m accomplishing things.

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: