0% found this document useful (0 votes)
9 views

Mat Plot Lib

Uploaded by

kolekarkeshav6
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Mat Plot Lib

Uploaded by

kolekarkeshav6
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Notebook

December 21, 2024

1 Data Visualization - Matplotlib


it is a libary that is help us to visualize our data
helps to understand data in pctorial foramat
Extensivaly used in EDA , and presnt machine learing mdels
it works best with numpy and pandas
Line Plot

[3]: import numpy as np


import pandas as pd
import matplotlib.pyplot as plt

[4]: df=pd.read_csv('./iris.csv')

[5]: df

[5]: sepal_length sepal_width petal_length petal_width species


0 5.1 3.5 1.4 0.2 setosa
1 4.9 3.0 1.4 0.2 setosa
2 4.7 3.2 1.3 0.2 setosa
3 4.6 3.1 1.5 0.2 setosa
4 5.0 3.6 1.4 0.2 setosa
.. … … … … …
145 6.7 3.0 5.2 2.3 virginica
146 6.3 2.5 5.0 1.9 virginica
147 6.5 3.0 5.2 2.0 virginica
148 6.2 3.4 5.4 2.3 virginica
149 5.9 3.0 5.1 1.8 virginica

[150 rows x 5 columns]

[6]: x=np.arange(0,10)
y= x**2
y2=2*x+3

keshav kolekar
[7]: plt.plot(x,y)
plt.plot(x,y2)
plt.show()

[8]: themes=plt.style.available
print(themes)

['Solarize_Light2', '_classic_test_patch', '_mpl-gallery', '_mpl-gallery-


nogrid', 'bmh', 'classic', 'dark_background', 'fast', 'fivethirtyeight',
'ggplot', 'grayscale', 'seaborn-v0_8', 'seaborn-v0_8-bright',
'seaborn-v0_8-colorblind', 'seaborn-v0_8-dark', 'seaborn-v0_8-dark-palette',
'seaborn-v0_8-darkgrid', 'seaborn-v0_8-deep', 'seaborn-v0_8-muted',
'seaborn-v0_8-notebook', 'seaborn-v0_8-paper', 'seaborn-v0_8-pastel',
'seaborn-v0_8-poster', 'seaborn-v0_8-talk', 'seaborn-v0_8-ticks',
'seaborn-v0_8-white', 'seaborn-v0_8-whitegrid', 'tableau-colorblind10']

[9]: plt.style.use('classic')

[10]: plt.plot(x,y,color='red',marker='o')
plt.plot(x,y2,color='green',marker='*')

plt.xlabel("time")

keshav kolekar
plt.ylabel("price")
# plt.xlim(0,12)
plt.title("Prices of smartphone over time")
plt.legend()
plt.show()

C:\Users\Keshav\AppData\Local\Temp\ipykernel_8252\2900917789.py:8: UserWarning:
No artists with labels found to put in legend. Note that artists whose label
start with an underscore are ignored when legend() is called with no argument.
plt.legend()

[ ]:

2 Scatter plot
plt.scatter()
scatters data points across x and y axis

keshav kolekar
[12]: plt.figure(figsize=(10,6))
plt.scatter(x,y,color='red',label='iphone')
plt.scatter(x,y2,color='green',label='android')
plt.xlabel("time")
plt.xlabel("price")

plt.show()

[13]: data=np.random.randn(100,2)

[14]: plt.scatter(x=data[:,0],y=data[:,1])
plt.show()

keshav kolekar
3 Bar Graphs
plt.bar()
plot a bar graph between heights and labels you provide

[16]: x=np.arange(0,5)
car1=[40,20,34,45,12]
car2=[20,40,24,55,62]

[17]: plt.bar(x,car1,width=0.3, tick_label=[2017,2018,2019,2020,2022],label='car1') #␣


↪tick are used to gives our customize labels

plt.bar(x+0.3,car2,width=0.3,label='car2')
plt.xlabel("years")
plt.ylabel("sales in doller")
plt.title("car price comparision")
plt.legend()
plt.xlim(-1,5)
plt.ylim(0,90)

keshav kolekar
plt.show()
# plt.show()

4 Pie chart
plt.pie()
plot the pie chart with the provide labels and value

[19]: # plt.pie?

[20]: subjects=['physics','maths','chemistry','english']
marks=np.array([45,97,67,78])

[21]: plt.pie(x=marks,labels=subjects,explode=[0,0.100,0,0],shadow=True,autopct="%0.
↪0f")

plt.show()

keshav kolekar
5 Histograms
plt.hist()
creating a dummy data using normal distribution

[23]: # to generate data in standard normal form


x_std=np.random.randn(500)

[24]: maths_mu=70
maths_sig=8
maths_marks= np.round(x_std*maths_sig + maths_mu)

phy_mu=50
phy_sig=10
phy_mu=np.round(x_std*phy_sig + phy_mu)

keshav kolekar
[25]: maths_marks

[25]: array([64., 54., 65., 61., 61., 67., 68., 60., 78., 79., 77., 63., 72.,
71., 70., 68., 83., 86., 72., 73., 66., 74., 77., 72., 69., 57.,
67., 74., 70., 83., 76., 77., 69., 79., 67., 54., 57., 67., 74.,
83., 55., 76., 61., 79., 86., 68., 75., 69., 69., 70., 71., 70.,
63., 73., 76., 69., 80., 79., 70., 64., 59., 72., 62., 64., 75.,
62., 76., 67., 79., 65., 72., 73., 79., 68., 73., 74., 57., 56.,
73., 77., 59., 88., 76., 58., 76., 56., 71., 54., 70., 69., 79.,
70., 74., 86., 59., 69., 82., 84., 82., 77., 55., 68., 56., 73.,
74., 78., 82., 70., 70., 80., 66., 68., 66., 74., 66., 46., 72.,
77., 67., 77., 67., 60., 78., 71., 59., 78., 73., 81., 73., 51.,
84., 60., 70., 62., 57., 54., 68., 52., 70., 77., 78., 74., 69.,
65., 76., 52., 65., 77., 68., 71., 59., 64., 69., 56., 74., 61.,
74., 73., 69., 64., 73., 72., 67., 64., 68., 86., 93., 72., 68.,
66., 64., 81., 60., 61., 66., 69., 71., 68., 80., 77., 70., 69.,
80., 71., 57., 65., 76., 68., 70., 69., 75., 83., 72., 62., 66.,
65., 65., 67., 72., 77., 97., 79., 67., 65., 77., 64., 77., 69.,
79., 85., 82., 61., 61., 60., 58., 78., 66., 69., 62., 63., 82.,
72., 79., 70., 75., 73., 70., 67., 90., 74., 71., 77., 59., 70.,
81., 73., 67., 67., 73., 64., 61., 75., 85., 66., 67., 75., 84.,
75., 77., 67., 71., 66., 81., 73., 60., 79., 75., 67., 78., 78.,
62., 77., 64., 70., 69., 79., 76., 82., 66., 67., 66., 56., 64.,
63., 74., 80., 73., 56., 57., 63., 72., 75., 65., 61., 65., 70.,
74., 65., 70., 74., 80., 70., 58., 72., 76., 78., 61., 82., 73.,
67., 71., 57., 69., 81., 66., 47., 72., 56., 67., 69., 72., 67.,
65., 72., 75., 70., 64., 75., 75., 81., 59., 76., 66., 65., 65.,
69., 80., 80., 62., 71., 60., 77., 76., 72., 67., 70., 78., 74.,
80., 75., 82., 73., 69., 66., 71., 52., 53., 59., 81., 74., 65.,
66., 86., 62., 60., 81., 72., 66., 64., 76., 72., 72., 88., 70.,
93., 74., 71., 73., 76., 69., 69., 75., 72., 86., 67., 70., 78.,
79., 74., 78., 70., 79., 80., 72., 64., 74., 58., 65., 77., 60.,
62., 60., 68., 70., 58., 61., 77., 42., 64., 68., 57., 69., 81.,
56., 76., 64., 74., 59., 74., 64., 59., 66., 76., 75., 65., 67.,
81., 76., 60., 65., 75., 71., 62., 69., 79., 66., 77., 92., 81.,
71., 71., 70., 60., 70., 80., 67., 70., 69., 65., 75., 80., 66.,
65., 73., 77., 59., 76., 66., 65., 75., 64., 67., 81., 56., 66.,
74., 79., 80., 75., 78., 71., 57., 78., 68., 67., 83., 66., 69.,
70., 75., 70., 63., 74., 78., 75., 65., 63., 53., 87., 75., 67.,
70., 89., 64., 76., 48., 71., 71., 70., 61., 69., 75., 66., 64.,
71., 70., 52., 80., 73., 78.])

[26]: plt.hist(maths_marks,bins=10)
# plt.xlim(0,150)
plt.hist(phy_mu,bins=10,alpha=0.6) # alpha is for opacity

plt.show()

keshav kolekar
[27]: maths_marks.min()

[27]: 42.0

[28]: maths_marks.max()

[28]: 97.0

[29]: maths_marks.mean()

[29]: 70.182

6 Creating the subplot


creating multiple plots in just a single figure

[31]: x=np.arange(0,10,0.1)
y1=x**2
y2=x**3
y3=np.sin(x)

keshav kolekar
y4=np.cos(x)

[32]: plt.subplot(2,2,1) # (2,2,1) this represent 2 rows and 2 column and 1 quadrant
plt.plot(x,y1)

plt.subplot(2,2,2)
plt.plot(x,y2)

plt.subplot(2,2,3)
plt.plot(x,y3)

plt.subplot(2,2,4)
plt.plot(x,y4)

plt.show()

[33]: # you will also crete 2 rows and 3 column figure


plt.subplot(2,3,1) # (2,2,1) this represent 2 rows and 2 column and 1 quadrant
plt.plot(x,y1)

10

keshav kolekar
plt.subplot(2,3,2)
plt.plot(x,y2)

plt.subplot(2,3,3)
plt.plot(x,y3)

plt.subplot(2,3,4)
plt.plot(x,y4)

plt.subplot(2,3,5)
plt.plot(x,y4)

plt.subplot(2,3,6)
plt.plot(x,y4)

plt.show()

11

keshav kolekar
7 3D plots
[35]: a=np.arange(4)
b=np.arange(4,7)

[36]: b

[36]: array([4, 5, 6])

[37]: a,b=np.meshgrid(a,b) # it repeat rows how many times number of b


# it repeat colums how many times number of a

[38]: a

[38]: array([[0, 1, 2, 3],


[0, 1, 2, 3],
[0, 1, 2, 3]])

[39]: b

[39]: array([[4, 4, 4, 4],


[5, 5, 5, 5],
[6, 6, 6, 6]])

[40]: a+b

[40]: array([[4, 5, 6, 7],


[5, 6, 7, 8],
[6, 7, 8, 9]])

[41]: # fig=plt.figure()
# ax = fig.gca(projection='3d')
# ax.plot_surface(a,b,a+b)
# plt.show()
fig = plt.figure()

# Add a 3D subplot
ax = fig.add_subplot(111, projection='3d')

# Plot the surface


ax.plot_surface(a, b, a + b, cmap='viridis')

# Show the plot


plt.show()

12

keshav kolekar
[42]: import matplotlib.pyplot as plt
import numpy as np

# Create sample data


a = np.linspace(-5, 5, 100)
b = np.linspace(-5, 5, 100)
a, b = np.meshgrid(a, b)

# Define Z as a function of a and b


z = a**2 + b**2

# Create a figure
fig = plt.figure()

# Add a 3D subplot
ax = fig.add_subplot(111, projection='3d')

13

keshav kolekar
# Plot the surface
ax.plot_surface(a, b, z, cmap='viridis')

# Show the plot


plt.show()

8 working with images


reading images
sclicing/cropping images
image manupulation
saving modified images

[44]: img=plt.imread('./pikachu.jpg')

14

keshav kolekar
[45]: type(img)

[45]: numpy.ndarray

[46]: plt.imshow(img )
# plt.axis('off')
plt.show()

[47]: img.shape # it is telling us height and width in the form of pixels

[47]: (600, 400, 3)

[48]: img # this numbers are represent the itensity of pixel


# 0 to 255 ... 0 means the pixel are completly died ..and 255 means the pixel␣
↪are highly intensive... their are basically

# 3 chanales such aas RGB(red,green ,blue)

15

keshav kolekar
[48]: array([[[145, 179, 225],
[144, 178, 223],
[144, 178, 223],
…,
[ 74, 114, 183],
[ 74, 114, 183],
[ 74, 114, 183]],

[[145, 179, 224],


[145, 179, 224],
[146, 179, 224],
…,
[ 75, 115, 184],
[ 74, 114, 183],
[ 74, 114, 183]],

[[145, 179, 224],


[147, 180, 225],
[148, 181, 224],
…,
[ 75, 115, 184],
[ 75, 115, 184],
[ 75, 115, 184]],

…,

[[ 0, 65, 31],
[ 0, 69, 35],
[ 1, 72, 38],
…,
[ 1, 71, 37],
[ 0, 70, 36],
[ 0, 69, 35]],

[[ 6, 73, 40],
[ 4, 74, 40],
[ 2, 72, 38],
…,
[ 1, 71, 37],
[ 0, 70, 36],
[ 0, 69, 35]],

[[ 3, 70, 37],
[ 0, 69, 35],
[ 0, 70, 36],
…,
[ 0, 69, 35],

16

keshav kolekar
[ 0, 69, 35],
[ 0, 69, 35]]], dtype=uint8)

[49]: pikachu_face=img[330:515,190:390,:]

[50]: pikachu_face.shape

[50]: (185, 200, 3)

[51]: plt.imshow(pikachu_face)
plt.axis('off')
plt.show()

[52]: # you can also save this image


plt.imsave('./pikachu_face.jpg',pikachu_face)

[53]: img_copy=img.copy()

17

keshav kolekar
[54]: img_copy[:,:,0]=0

[55]: plt.imshow(img_copy)
plt.axis('off')
plt.show() # there is no read color inthe img

[56]: img_copy1=img.copy()
img_copy1[:,:,1]=0
plt.imshow(img_copy1)
plt.axis('off')
plt.show()

18

keshav kolekar
[57]: img_copy2=img.copy()
img_copy2[:,:,2]=0
plt.imshow(img_copy2)
plt.axis('off')
plt.show()

19

keshav kolekar
[58]: # border image solution
row=np.zeros((10,400,3),dtype='int')

[59]: row.shape

[59]: (10, 400, 3)

[60]: plt.imshow(row)
plt.axis('off')
plt.show()

[61]: mod_img=np.vstack((row,img,row))

20

keshav kolekar
[62]: plt.imshow(mod_img)
plt.axis('off')
plt.show()

[63]: columns=np.zeros((600,10,3),dtype='int')

[64]: columns.shape

[64]: (600, 10, 3)

[65]: plt.imshow(columns)
plt.axis('off')
plt.show()

21

keshav kolekar
[66]: mod_img=np.hstack((columns,mod_img,columns))

---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[66], line 1
----> 1 mod_img=np.hstack((columns,mod_img,columns))

File D:\Anaconda\Lib\site-packages\numpy\core\shape_base.py:359, in hstack(tup,␣


↪dtype, casting)

357 return _nx.concatenate(arrs, 0, dtype=dtype, casting=casting)


358 else:
--> 359 return _nx.concatenate(arrs, 1, dtype=dtype, casting=casting)

ValueError: all the input array dimensions except for the concatenation axis␣
↪must match exactly, but along dimension 0, the array at index 0 has size 600␣

↪and the array at index 1 has size 620

22

keshav kolekar
[ ]: plt.imshow(mod_img)
plt.axis('off')
plt.show()

9 Visualize iris dataset


get useful information inpictorial form

[67]: import pandas as pd

[69]: iris=pd.read_csv('./iris.csv')

[71]: iris.head()

[71]: sepal_length sepal_width petal_length petal_width species


0 5.1 3.5 1.4 0.2 setosa
1 4.9 3.0 1.4 0.2 setosa
2 4.7 3.2 1.3 0.2 setosa
3 4.6 3.1 1.5 0.2 setosa
4 5.0 3.6 1.4 0.2 setosa

[73]: petal_length=iris['petal_length']
petal_width=iris['petal_width']

[75]: plt.scatter(x=petal_length,y=petal_width)
plt.xlabel('petal_length')
plt.ylabel('petal_width')
plt.show()

23

keshav kolekar
[77]: setosa=iris[iris['species']=='setosa']
virginica=iris[iris['species']=='virginica']
versicolor=iris[iris['species']=='versicolor']

[79]: setosa

[79]: sepal_length sepal_width petal_length petal_width species


0 5.1 3.5 1.4 0.2 setosa
1 4.9 3.0 1.4 0.2 setosa
2 4.7 3.2 1.3 0.2 setosa
3 4.6 3.1 1.5 0.2 setosa
4 5.0 3.6 1.4 0.2 setosa
5 5.4 3.9 1.7 0.4 setosa
6 4.6 3.4 1.4 0.3 setosa
7 5.0 3.4 1.5 0.2 setosa
8 4.4 2.9 1.4 0.2 setosa
9 4.9 3.1 1.5 0.1 setosa
10 5.4 3.7 1.5 0.2 setosa
11 4.8 3.4 1.6 0.2 setosa
12 4.8 3.0 1.4 0.1 setosa

24

keshav kolekar
13 4.3 3.0 1.1 0.1 setosa
14 5.8 4.0 1.2 0.2 setosa
15 5.7 4.4 1.5 0.4 setosa
16 5.4 3.9 1.3 0.4 setosa
17 5.1 3.5 1.4 0.3 setosa
18 5.7 3.8 1.7 0.3 setosa
19 5.1 3.8 1.5 0.3 setosa
20 5.4 3.4 1.7 0.2 setosa
21 5.1 3.7 1.5 0.4 setosa
22 4.6 3.6 1.0 0.2 setosa
23 5.1 3.3 1.7 0.5 setosa
24 4.8 3.4 1.9 0.2 setosa
25 5.0 3.0 1.6 0.2 setosa
26 5.0 3.4 1.6 0.4 setosa
27 5.2 3.5 1.5 0.2 setosa
28 5.2 3.4 1.4 0.2 setosa
29 4.7 3.2 1.6 0.2 setosa
30 4.8 3.1 1.6 0.2 setosa
31 5.4 3.4 1.5 0.4 setosa
32 5.2 4.1 1.5 0.1 setosa
33 5.5 4.2 1.4 0.2 setosa
34 4.9 3.1 1.5 0.1 setosa
35 5.0 3.2 1.2 0.2 setosa
36 5.5 3.5 1.3 0.2 setosa
37 4.9 3.1 1.5 0.1 setosa
38 4.4 3.0 1.3 0.2 setosa
39 5.1 3.4 1.5 0.2 setosa
40 5.0 3.5 1.3 0.3 setosa
41 4.5 2.3 1.3 0.3 setosa
42 4.4 3.2 1.3 0.2 setosa
43 5.0 3.5 1.6 0.6 setosa
44 5.1 3.8 1.9 0.4 setosa
45 4.8 3.0 1.4 0.3 setosa
46 5.1 3.8 1.6 0.2 setosa
47 4.6 3.2 1.4 0.2 setosa
48 5.3 3.7 1.5 0.2 setosa
49 5.0 3.3 1.4 0.2 setosa

[81]: plt.
↪scatter(setosa['petal_length'],setosa['petal_width'],color='green',label="setosa")

plt.
↪scatter(virginica['petal_length'],virginica['petal_width'],color='red',label='virginica')

plt.
↪scatter(versicolor['petal_length'],versicolor['petal_width'],color='blue',label='versicolor'

plt.xlabel('petal_length')
plt.ylabel('petal_width')
plt.xlim(0,12)

25

keshav kolekar
plt.legend()
plt.show()

[83]: plt.hist(iris['petal_length'],bins=20)
plt.xlabel('petal_length')
plt.ylabel('petal_width')
plt.show()

26

keshav kolekar
[85]: iris['species'].value_counts()

[85]: species
setosa 50
versicolor 50
virginica 50
Name: count, dtype: int64

[87]: plt.pie(iris['species'].value_counts(),labels=iris['species'].value_counts().
↪index,autopct='%0.0f')

plt.show()

27

keshav kolekar
[89]: movie_meta=pd.read_csv('./movie_meta.csv')

[91]: movie_meta.shape

[91]: (5043, 28)

[93]: movie_meta.describe()

[93]: num_critic_for_reviews duration director_facebook_likes \


count 4993.000000 5028.000000 4939.000000
mean 140.194272 107.201074 686.509212
std 121.601675 25.197441 2813.328607
min 1.000000 7.000000 0.000000
25% 50.000000 93.000000 7.000000
50% 110.000000 103.000000 49.000000
75% 195.000000 118.000000 194.500000
max 813.000000 511.000000 23000.000000

28

keshav kolekar
actor_3_facebook_likes actor_1_facebook_likes gross \
count 5020.000000 5036.000000 4.159000e+03
mean 645.009761 6560.047061 4.846841e+07
std 1665.041728 15020.759120 6.845299e+07
min 0.000000 0.000000 1.620000e+02
25% 133.000000 614.000000 5.340988e+06
50% 371.500000 988.000000 2.551750e+07
75% 636.000000 11000.000000 6.230944e+07
max 23000.000000 640000.000000 7.605058e+08

num_voted_users cast_total_facebook_likes facenumber_in_poster \


count 5.043000e+03 5043.000000 5030.000000
mean 8.366816e+04 9699.063851 1.371173
std 1.384853e+05 18163.799124 2.013576
min 5.000000e+00 0.000000 0.000000
25% 8.593500e+03 1411.000000 0.000000
50% 3.435900e+04 3090.000000 1.000000
75% 9.630900e+04 13756.500000 2.000000
max 1.689764e+06 656730.000000 43.000000

num_user_for_reviews budget title_year \


count 5022.000000 4.551000e+03 4935.000000
mean 272.770808 3.975262e+07 2002.470517
std 377.982886 2.061149e+08 12.474599
min 1.000000 2.180000e+02 1916.000000
25% 65.000000 6.000000e+06 1999.000000
50% 156.000000 2.000000e+07 2005.000000
75% 326.000000 4.500000e+07 2011.000000
max 5060.000000 1.221550e+10 2016.000000

actor_2_facebook_likes imdb_score aspect_ratio movie_facebook_likes


count 5030.000000 5043.000000 4714.000000 5043.000000
mean 1651.754473 6.442138 2.220403 7525.964505
std 4042.438863 1.125116 1.385113 19320.445110
min 0.000000 1.600000 1.180000 0.000000
25% 281.000000 5.800000 1.850000 0.000000
50% 595.000000 6.600000 2.350000 166.000000
75% 918.000000 7.200000 2.350000 3000.000000
max 137000.000000 9.500000 16.000000 349000.000000

[95]: movie_meta.columns

[95]: Index(['color', 'director_name', 'num_critic_for_reviews', 'duration',


'director_facebook_likes', 'actor_3_facebook_likes', 'actor_2_name',
'actor_1_facebook_likes', 'gross', 'genres', 'actor_1_name',
'movie_title', 'num_voted_users', 'cast_total_facebook_likes',

29

keshav kolekar
'actor_3_name', 'facenumber_in_poster', 'plot_keywords',
'movie_imdb_link', 'num_user_for_reviews', 'language', 'country',
'content_rating', 'budget', 'title_year', 'actor_2_facebook_likes',
'imdb_score', 'aspect_ratio', 'movie_facebook_likes'],
dtype='object')

[97]: movie_meta.head()

[97]: color director_name num_critic_for_reviews duration \


0 Color James Cameron 723.0 178.0
1 Color Gore Verbinski 302.0 169.0
2 Color Sam Mendes 602.0 148.0
3 Color Christopher Nolan 813.0 164.0
4 NaN Doug Walker NaN NaN

director_facebook_likes actor_3_facebook_likes actor_2_name \


0 0.0 855.0 Joel David Moore
1 563.0 1000.0 Orlando Bloom
2 0.0 161.0 Rory Kinnear
3 22000.0 23000.0 Christian Bale
4 131.0 NaN Rob Walker

actor_1_facebook_likes gross genres … \


0 1000.0 760505847.0 Action|Adventure|Fantasy|Sci-Fi …
1 40000.0 309404152.0 Action|Adventure|Fantasy …
2 11000.0 200074175.0 Action|Adventure|Thriller …
3 27000.0 448130642.0 Action|Thriller …
4 131.0 NaN Documentary …

num_user_for_reviews language country content_rating budget \


0 3054.0 English USA PG-13 237000000.0
1 1238.0 English USA PG-13 300000000.0
2 994.0 English UK PG-13 245000000.0
3 2701.0 English USA PG-13 250000000.0
4 NaN NaN NaN NaN NaN

title_year actor_2_facebook_likes imdb_score aspect_ratio \


0 2009.0 936.0 7.9 1.78
1 2007.0 5000.0 7.1 2.35
2 2015.0 393.0 6.8 2.35
3 2012.0 23000.0 8.5 2.35
4 NaN 12.0 7.1 NaN

movie_facebook_likes
0 33000
1 0
2 85000

30

keshav kolekar
3 164000
4 0

[5 rows x 28 columns]

[99]: movie_meta.tail()

[99]: color director_name num_critic_for_reviews duration \


5038 Color Scott Smith 1.0 87.0
5039 Color NaN 43.0 43.0
5040 Color Benjamin Roberds 13.0 76.0
5041 Color Daniel Hsia 14.0 100.0
5042 Color Jon Gunn 43.0 90.0

director_facebook_likes actor_3_facebook_likes actor_2_name \


5038 2.0 318.0 Daphne Zuniga
5039 NaN 319.0 Valorie Curry
5040 0.0 0.0 Maxwell Moody
5041 0.0 489.0 Daniel Henney
5042 16.0 16.0 Brian Herzlinger

actor_1_facebook_likes gross genres … \


5038 637.0 NaN Comedy|Drama …
5039 841.0 NaN Crime|Drama|Mystery|Thriller …
5040 0.0 NaN Drama|Horror|Thriller …
5041 946.0 10443.0 Comedy|Drama|Romance …
5042 86.0 85222.0 Documentary …

num_user_for_reviews language country content_rating budget \


5038 6.0 English Canada NaN NaN
5039 359.0 English USA TV-14 NaN
5040 3.0 English USA NaN 1400.0
5041 9.0 English USA PG-13 NaN
5042 84.0 English USA PG 1100.0

title_year actor_2_facebook_likes imdb_score aspect_ratio \


5038 2013.0 470.0 7.7 NaN
5039 NaN 593.0 7.5 16.00
5040 2013.0 0.0 6.3 NaN
5041 2012.0 719.0 6.3 2.35
5042 2004.0 23.0 6.6 1.85

movie_facebook_likes
5038 84
5039 32000
5040 16
5041 660

31

keshav kolekar
5042 456

[5 rows x 28 columns]

[ ]:

[ ]:

This notebook was converted with convert.ploomber.io

32

keshav kolekar

You might also like