Introduction to pandas

Python Programming Introduction to pandas
8 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€64.90
List Price:  €92.72
You save:  €27.82
£55.48
List Price:  £79.26
You save:  £23.78
CA$94.84
List Price:  CA$135.49
You save:  CA$40.65
A$107.44
List Price:  A$153.49
You save:  A$46.05
S$94.44
List Price:  S$134.92
You save:  S$40.48
HK$547.73
List Price:  HK$782.50
You save:  HK$234.77
CHF 63.11
List Price:  CHF 90.16
You save:  CHF 27.05
NOK kr759.51
List Price:  NOK kr1,085.06
You save:  NOK kr325.55
DKK kr484.31
List Price:  DKK kr691.90
You save:  DKK kr207.59
NZ$117.18
List Price:  NZ$167.41
You save:  NZ$50.23
د.إ257.02
List Price:  د.إ367.19
You save:  د.إ110.16
৳7,686.18
List Price:  ৳10,980.73
You save:  ৳3,294.54
₹5,834.28
List Price:  ₹8,335.04
You save:  ₹2,500.76
RM330.66
List Price:  RM472.40
You save:  RM141.73
₦97,668.24
List Price:  ₦139,532.04
You save:  ₦41,863.80
₨19,468.63
List Price:  ₨27,813.53
You save:  ₨8,344.89
฿2,546.70
List Price:  ฿3,638.31
You save:  ฿1,091.60
₺2,265.91
List Price:  ₺3,237.16
You save:  ₺971.24
B$351.06
List Price:  B$501.53
You save:  B$150.47
R1,322.01
List Price:  R1,888.66
You save:  R566.65
Лв126.52
List Price:  Лв180.76
You save:  Лв54.23
₩94,315.14
List Price:  ₩134,741.70
You save:  ₩40,426.55
₪257.38
List Price:  ₪367.71
You save:  ₪110.32
₱3,931.96
List Price:  ₱5,617.33
You save:  ₱1,685.37
¥10,592.26
List Price:  ¥15,132.45
You save:  ¥4,540.19
MX$1,160.67
List Price:  MX$1,658.17
You save:  MX$497.50
QR255.40
List Price:  QR364.88
You save:  QR109.47
P964.60
List Price:  P1,378.06
You save:  P413.46
KSh9,279.27
List Price:  KSh13,256.67
You save:  KSh3,977.40
E£3,320.75
List Price:  E£4,744.14
You save:  E£1,423.38
ብር3,980.93
List Price:  ብር5,687.29
You save:  ብር1,706.36
Kz58,401.19
List Price:  Kz83,433.85
You save:  Kz25,032.66
CLP$68,800.17
List Price:  CLP$98,290.17
You save:  CLP$29,490
CN¥505.43
List Price:  CN¥722.08
You save:  CN¥216.64
RD$4,147
List Price:  RD$5,924.54
You save:  RD$1,777.54
DA9,435.57
List Price:  DA13,479.97
You save:  DA4,044.39
FJ$157.96
List Price:  FJ$225.66
You save:  FJ$67.70
Q546.07
List Price:  Q780.13
You save:  Q234.06
GY$14,663.88
List Price:  GY$20,949.30
You save:  GY$6,285.42
ISK kr9,758.70
List Price:  ISK kr13,941.60
You save:  ISK kr4,182.90
DH709.58
List Price:  DH1,013.74
You save:  DH304.15
L1,235.01
List Price:  L1,764.37
You save:  L529.36
ден3,991.30
List Price:  ден5,702.11
You save:  ден1,710.80
MOP$564.38
List Price:  MOP$806.29
You save:  MOP$241.91
N$1,336.41
List Price:  N$1,909.24
You save:  N$572.83
C$2,577.43
List Price:  C$3,682.20
You save:  C$1,104.77
रु9,342.84
List Price:  रु13,347.49
You save:  रु4,004.64
S/260.45
List Price:  S/372.08
You save:  S/111.63
K268
List Price:  K382.87
You save:  K114.87
SAR262.59
List Price:  SAR375.15
You save:  SAR112.55
ZK1,736.79
List Price:  ZK2,481.24
You save:  ZK744.44
L322.64
List Price:  L460.94
You save:  L138.29
Kč1,642.49
List Price:  Kč2,346.52
You save:  Kč704.02
Ft25,571.54
List Price:  Ft36,532.34
You save:  Ft10,960.80
SEK kr748.30
List Price:  SEK kr1,069.05
You save:  SEK kr320.74
ARS$60,059.22
List Price:  ARS$85,802.56
You save:  ARS$25,743.34
Bs483.92
List Price:  Bs691.35
You save:  Bs207.42
COP$270,819.36
List Price:  COP$386,901.39
You save:  COP$116,082.02
₡35,222.95
List Price:  ₡50,320.66
You save:  ₡15,097.70
L1,728.74
List Price:  L2,469.73
You save:  L740.99
₲517,758.37
List Price:  ₲739,686.52
You save:  ₲221,928.15
$U2,629.19
List Price:  $U3,756.16
You save:  $U1,126.96
zł279.29
List Price:  zł399
You save:  zł119.71
Already have an account? Log In

Transcript

In this lesson, we'll be starting with pandas. So pandas is a very useful and powerful library, mainly used for data analysis and process. The main difference between NumPy and pandas is that in the first one, we define a single function for data management. In the second one, we find packages of function grouped into single function. And from this, we can already get how pandas is extremely effective and fast for everything related to analysis, management and processing of data. pandas is the best package to use.

So after this small introduction, let me show you an example. So first look at this data set called Titanic. So this is a CSV file, which you can easily open through Excel. So the first column we have the number of passengers in the second one we have Have the passengers survived the accident or not. In the third there is class and then the name sakes age, the number of relatives on board, the ticket code, the ticket price, the Kevin number and finally the place of inbox. So basically these are all characteristics of our CSV data.

And if we scroll down, we can see that there are total each 91 observations. Now what do we need to do is to understand how to analyze and process this data in pandas. So let's do it one step at a time. So open your Python now here will first read the data. Now to read it here. First, what I'll do is I'll import pandas, so import pandas as PD, then run it so it's running because star is still here.

So it's done now. Now import the data here, right data equal to PD dot read underscore CSV and within this bracket we are a force bracket give the location where you type any dot CSV file is located. So here in this folder, I will just copy the location from here and I'll paste it over here. Now remember to change this slash, this old slash will be now forward slash instead of a backward slash, so not change this. Now, at last, give us cash once again and write the data set name. So my dataset name is tightening and extension is dot CSV.

That is the type of file it is. So now it is written, and now run this so it's running and it's run perfectly. Now To check the data, what it imported, just write data and run it. So here is our chart. Now if you scroll, we see a short of summary that shows us the number of rows and columns of this chart. So here see there are 891 rows, and 12 columns.

So once we have seen this, however, I want to tell you that printing the whole chart, in this case is not very useful. After all, we only need to check if the chart has been read correctly or not. So to reduce the load of load of data to be loaded and speed up operation, we use the head function that actually allow us to print only for example, the first five lines, so here, let me show you this here. I'll just write data dot head, then give a pair of brackets Run. See, the first five observations are printed with index numbers zero to four. Now if you want to view more than five, then what you can do is just right within this pair of first bracket 10 and see first and observation is printed, and the index number is zero to nine.

Now let's see how that type of data in pandas are called, let's write data dot info. So, in NumPy, we have seen that the data type is called nd array now we'll see how it is called in pandas. So we have written data dot info with a pair of first bracket and run it. So this is the detailed record of my data set. We can see here in the first line that the data in pandas are called Data Frame C, which is basically a data matrices consisting of rows and columns, then in the second row, we can find a range of the index. As previously seen.

In total, there are 891 lines, so with the index number from zero to 890. So as it contains 891 entries, so the index number should be zero to 890. So after that, our chart tells us how many columns our data have, that is 12 columns, and below the list of column from first to last. Then after the column names, we find this number of numbers that represent the amount of values of each column C, then some are different. As we'll understand why later, we have types of data that can be an integer, an object also can be float, the object is exactly nice. train in NumPy.

Then below we find the D type, which tells us how many rows are in float form, and how many in other informants and how many are in objects. And lastly, the occupied memory is shown in the last line. So this is the occupied memory of this data. So as we have seen the info function is very useful one, so we have the information in just printed in a few lines, then let's now see how the index function work. So, let me write here data dot index and run. So from here we can see that this function so shows us only the index range.

Now, another useful function is column, which prints the name of all the columns. So, just write data dot column columns and here we have all the names Then we can also print the values using the function values. So just write here data dot values and run it, see the values are printed here. Now let's move on to the last function we'll see for this that is the D type function, it is actually very useful to us and it prints the type of data belonging to each row of our chart. So let's write data dot d type. Now run it See, it will give you the detailed record of each variable that is each column and their data type.

So passenger ID is in 64, survived is in 64. Name is object that is a string age is float. So in this way, you can get a detailed record of data type that is, what are your columns What type of columns you have by running this D type function. So, this is the end of our lesson. So here we have just started with a panda's. We'll move forward with pandas in our next lectures.

So till then keep practicing what I've taught you till now. See you in the next video. Thank you

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.