Creating Data Frames in Pandas
ACCESS the FULL COURSE here: https://academy.zenva.com/product/bite-sized-coding-academy/
TRANSCRIPT
In this video we're going to get started with Pandas, and so learn a little about what the fundamental data structure for Pandas is as well as learning how to access a data using a thing called data frame. But first of all what we'll need to do is download the source code and we'll need to copy them into whatever working directory on your computer. 'Cause inside here we have these files that we'll need. So you'll have to copy these files over into your working directory. So I've already done this and created a folder called Pandas and I've copied over all of these things that we'll need. You'll want to open up your Anaconda Navigator and make sure you have the right environment selected and then we're going to launch Spyder. Okay, so lets get started. So we'll need to import Pandas, import Pandas as pd And I'm also going to import numpy as np just so that we're going to use it to populate data. We're gonna talk a little bit about Pandas, what the fundamentals data structure behind Pandas is. And the thing is called a DataFrame. And a DataFrame you can think of it as just being a single spreadsheet. A 2D table with rows and columns. So let's just create a DataFrame from just some data that we have. So remember it's a 2D table. So how I can define a dataframe is I can use a dictionary first, then give it to Pandas and say Hey, can you convert this dictionary into a dataframe. Each of the keys are going to be columns and the values are going to be rows. Column one, now I can just populate it with some random values, np.random.rand five. Essentially what I have done is created a single column and it has five rows. So let's just create this dataframe first so that we can see it. df equals, I can just create one by saying pd.DataFrame and I just pass it in this dictionary. Pass in now I've created a DataFrame. Let's see what this looks like. I can run this guy and you'll see I have column one and then just some random garbage values. So let's go a head and create another column, create another one and you'll see now we have three columns. And so this is just how we can give into or you can give data to Pandas into a dataframe just by using this dictionary where the keys are the columns and the values are going to be the actual values for that column. We'll see if we can fetch some rows and how we can fetch some columns. Index it like you would a list. So I'll say, let's get some, I'll run this and you'll see that we'll get the first two rows because remember that this goes, we start at zero and we go up two but not including this index. So we get zero and one. Instead we need to see what the column name is. So let's do col1 and what that will do is when I run it print out all of the rows the entire column, all the rows for this particular column and it even goes so far as to tell me the data type. In order to fetch multiple columns we actually use a list inside here. Suppose I want to fetch the first two column I can say something like print df and then inside of here instead of doing just quotes here I can do a list, I'm indexing and I'm giving it a list to index on. So I can say col and col2. So now if you see we have extracted two columns.
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Creating Data Frames in Pandas», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.