How to Access Data using DataFrames with Pandas
Zenva
ACCESS the FULL COURSE here: https://academy.zenva.com/product/data-science-mini-degree/?zva_src=youtube-datascience-md
TRANSCRIPT
In this video we're going to get started with pandas and learn a little bit about what the fundamental data structure for pandas is, as well as learning how to access data using this thing called the data frame And that's what pandas is going to be using. But first of all, what we'll need to do is download the source code and then unzip it, because there's some files in there that we're gonna be working with and we'll need to copy them into whatever working directory on your computer. So it'll be a source code file and at this point you would've already downloaded the environment file and then unzipped that and then loaded it up into Anaconda. So we have the right environment file in Anaconda, but also you have to download the source code file, 'cause inside here, along with these other python files, we have these files that we'll need as well. There's some CSV files and then a spreadsheet. So you'll have to copy these files over into your working directories. So I've already done this. I've created a folder called pandas in my home directory essentially, and I've copied over all of these things that we'll need. So, after I have this set up, and after I have Anaconda set up, we can get started with pandas.
So, you'll want to open up your Anaconda navigator and make sure that you have the right environment selected. So, if you remember, at this point we assume that you've already downloaded the zip file, you've unzipped it, and then imported that into Anaconda. So, we've already covered how to do that, so make sure that the correct one is selected, and then we're going to launch Spyder, 'cause we're gonna be working with Spyder. So I already have an instance, Spyder running here, so you'll just get an empty document here, and then this iPython console where we can see our output. So we're gonna save this file in the same directory as where I keep the spreadsheets. So we'll call this something like intro.py for example. So I'll save that, and it's saved in the same directory. So now I can load files or anything from that, because everything is nice and neat in the same directory. Okay, so let's get started. So, we'll need to import pandas, so do import pandas, and conventionally what you see people do with Pandas is, you don't want to keep typing pandas over and over again, so you usually do an import alias. So you'd say import pandas as pd, and so now, anytime I'm doing anything with pandas, I can just say pd and then dot. I don't have to say the full pandas. It's just an easier way to shorten up the import and save you some typing. Then I'm also gonna import numpy as np, just so that, we're gonna use it to populate da ... https://www.youtube.com/watch?v=qYc58lb--Q4
62203828 Bytes