1
00:00:00,350 --> 00:00:07,020
No that's how you have a basic understanding of pandas and you know how to use Jupiter notebooks.  

2
00:00:07,020 --> 00:00:15,850
We can go ahead and learn how to load various kinds of files in python using pandas and Jupiter so I've

3
00:00:15,850 --> 00:00:18,730
got five files here.

4
00:00:18,740 --> 00:00:22,550
They contain exactly the same datasets.

5
00:00:22,610 --> 00:00:30,190
This is a text version or let me open the Excel version that will show a pretty overview of the data

6
00:00:30,490 --> 00:00:31,250
as you can see.

7
00:00:31,300 --> 00:00:38,980
So we've got seven lines of code including the header and we have also seven columns.

8
00:00:39,610 --> 00:00:44,010
So it's just some basic data of supermarkets.

9
00:00:44,440 --> 00:00:52,400
So the address, city, state, country, and the name of the supermarket and number of employees.

10
00:00:53,500 --> 00:00:58,180
And similarly we have exactly some of the same data but in different formats.

11
00:00:58,180 --> 00:01:02,940
So we have csv-s, and csv-s means comma separated values.

12
00:01:03,070 --> 00:01:11,140
So it's basically a text file where the values the columns are separated by commas as you can see here.

13
00:01:11,140 --> 00:01:18,740
So every column is separated by a coma, but it has a csv extension and it can be open with Excel.

14
00:01:18,760 --> 00:01:24,340
So if I open this now you'll see the same data set that you saw in the Excel file, we also have the

15
00:01:24,340 --> 00:01:32,140
same data separated by same line columns as you can see in here.

16
00:01:32,360 --> 00:01:32,670
And yeah.

17
00:01:33,640 --> 00:01:38,500
If you're working with data you're probably familiar with these kinds of files.

18
00:01:38,500 --> 00:01:45,820
So this is how to store data you need to have some conventions and using such convention then you

19
00:01:45,820 --> 00:01:49,760
use other programs such as Python to load these data.

20
00:01:50,050 --> 00:01:58,660
So when you load a csv file Python knows that the values will be separated by commas and it knows

21
00:01:58,930 --> 00:02:00,400
how to separate them.

22
00:02:00,400 --> 00:02:03,730
It knows how to extract values.

23
00:02:03,880 --> 00:02:06,290
So we'll open all these one by one.

24
00:02:06,340 --> 00:02:07,810
We also have a Json File

25
00:02:11,710 --> 00:02:18,340
which is yet another format to store data and looks like a Python dictionary actually.

26
00:02:18,370 --> 00:02:22,670
So we'll learn how to convert them to a pandas data frame as well.

27
00:02:22,720 --> 00:02:26,320
So all of these will be converted to pandas data frames.

28
00:02:26,400 --> 00:02:32,380
Yeah I'll go ahead and start Jupiter. Jupiter notebook.

29
00:02:32,920 --> 00:02:34,350
Here are my files.

30
00:02:34,390 --> 00:02:38,690
I'll go ahead and create a new Jupiter notebook for Python 3.

31
00:02:38,980 --> 00:02:45,910
Before I go ahead and load those files in Python there's a trick I do usually. I import os and then

32
00:02:45,970 --> 00:02:53,260
os.listdir and Alt Enter, execute that, you go to the next line and what you get is

33
00:02:53,500 --> 00:02:59,100
you get a list of files and folders as well, or file names that you have in the current directory.

34
00:02:59,650 --> 00:03:03,260
So no I don't have to switch to my folder to look at the names.

35
00:03:03,280 --> 00:03:04,780
I have everything in here.

36
00:03:04,810 --> 00:03:06,610
Now I can go ahead and import Pandas

37
00:03:09,280 --> 00:03:11,900
and let's start loading these files one by one.

38
00:03:12,340 --> 00:03:13,630
Let's say df1.

39
00:03:13,660 --> 00:03:20,450
So data frame one and that will be equal to pandas.read_csv.

40
00:03:23,280 --> 00:03:28,650
And then you have to pass the name of the file that you want to open supermarkets.csv.

41
00:03:28,690 --> 00:03:34,990
And just enter and maybe you want to print that out so df

42
00:03:35,020 --> 00:03:36,420
there.

43
00:03:36,750 --> 00:03:36,910
Yeah.

44
00:03:36,910 --> 00:03:43,270
What we got here is so we loaded the data frame first and then we printed that out so that we got this

45
00:03:43,570 --> 00:03:45,520
table nice table in there.

46
00:03:45,640 --> 00:03:48,930
That's how easy it is to load data from a csv file.

47
00:03:49,040 --> 00:03:55,120
Now the benefit of having the data in Python is that once you load them in Python you can do many many

48
00:03:55,120 --> 00:03:57,170
operations with your data.

49
00:03:57,220 --> 00:04:01,540
You can do statistics and add new columns you can.

50
00:04:01,540 --> 00:04:07,630
You can merge columns you can add the numbers of one column to the numbers of the other columns and

51
00:04:07,620 --> 00:04:13,530
at the ends you can export those data back
to formats like csv, Excel, etc.

52
00:04:13,600 --> 00:04:19,630
So we're going to do that later but first let's see how we load data from several file formats in the

53
00:04:19,630 --> 00:04:20,130
next videos.

