CVA Assignment no 8 (002703664) - Jupyter Notebook
pdf
keyboard_arrow_up
School
Northeastern University *
*We aren’t endorsed by this school
Course
6600
Subject
Industrial Engineering
Date
Feb 20, 2024
Type
Pages
7
Uploaded by PrivateDove4065
4/13/23, 9:24 PM
CVA Assignment no 8 (002703664) - Jupyter Notebook
localhost:8888/notebooks/CVA Assignment no 8 (002703664).ipynb
1/7
In [2]:
In [3]:
import
pandas as
pd
import
altair as
alt
dataframe6
=
pd.read_csv(
r"C:\Users\adiik\Downloads\googleplaystore.csv"
)
4/13/23, 9:24 PM
CVA Assignment no 8 (002703664) - Jupyter Notebook
localhost:8888/notebooks/CVA Assignment no 8 (002703664).ipynb
2/7
In [4]:
In [5]:
Out[4]:
App
Category
Rating
Reviews
Size
Installs
Type
P
0
Photo
Editor &
Candy
Camera &
Grid &
ScrapBook
ART_AND_DESIGN
4.1
159
19M
10,000+
Free
1
Coloring
book
moana
ART_AND_DESIGN
3.9
967
14M
500,000+
Free
2
U
Launcher
Lite –
FREE Live
Cool
Themes,
Hide ...
ART_AND_DESIGN
4.7
87510
8.7M
5,000,000+
Free
3
Sketch -
Draw &
Paint
ART_AND_DESIGN
4.5
215644
25M
50,000,000+
Free
4
Pixel Draw
- Number
Art
Coloring
Book
ART_AND_DESIGN
4.3
967
2.8M
100,000+
Free
...
...
...
...
...
...
...
...
10836
Sya9a
Maroc - FR
FAMILY
4.5
38
53M
5,000+
Free
10837
Fr. Mike
Schmitz
Audio
Teachings
FAMILY
5.0
4
3.6M
100+
Free
10838
Parkinson
Exercices
FR
MEDICAL
NaN
3
9.5M
1,000+
Free
10839
The SCP
Foundation
DB fr nn5n
BOOKS_AND_REFERENCE
4.5
114
Varies
with
device
1,000+
Free
10840
iHoroscope
- 2018
Daily
Horoscope
& Astrology
LIFESTYLE
4.5
398307
19M
10,000,000+
Free
10841 rows × 13 columns
dataframe6
# Removing the entries in the DataFrame that have features values of NA.
4/13/23, 9:24 PM
CVA Assignment no 8 (002703664) - Jupyter Notebook
localhost:8888/notebooks/CVA Assignment no 8 (002703664).ipynb
3/7
In [6]:
In [7]:
In [8]:
Requirement already satisfied: altair in c:\users\adiik\anaconda3\lib\sit
e-packages (4.2.2)
Requirement already satisfied: vega_datasets in c:\users\adiik\anaconda3
\lib\site-packages (0.9.0)
Requirement already satisfied: pandas>=0.18 in c:\users\adiik\anaconda3\l
ib\site-packages (from altair) (1.4.4)
Requirement already satisfied: jinja2 in c:\users\adiik\anaconda3\lib\sit
e-packages (from altair) (2.11.3)
Requirement already satisfied: jsonschema>=3.0 in c:\users\adiik\anaconda
3\lib\site-packages (from altair) (4.16.0)
Requirement already satisfied: entrypoints in c:\users\adiik\anaconda3\li
b\site-packages (from altair) (0.4)
Requirement already satisfied: toolz in c:\users\adiik\anaconda3\lib\site
-packages (from altair) (0.11.2)
Requirement already satisfied: numpy in c:\users\adiik\anaconda3\lib\site
-packages (from altair) (1.21.5)
Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.1
4.0 in c:\users\adiik\anaconda3\lib\site-packages (from jsonschema>=3.0->
altair) (0.18.0)
Requirement already satisfied: attrs>=17.4.0 in c:\users\adiik\anaconda3
\lib\site-packages (from jsonschema>=3.0->altair) (21.4.0)
Requirement already satisfied: python-dateutil>=2.8.1 in c:\users\adiik\a
naconda3\lib\site-packages (from pandas>=0.18->altair) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in c:\users\adiik\anaconda3\l
ib\site-packages (from pandas>=0.18->altair) (2022.1)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\adiik\anacond
a3\lib\site-packages (from jinja2->altair) (2.0.1)
Requirement already satisfied: six>=1.5 in c:\users\adiik\anaconda3\lib\s
ite-packages (from python-dateutil>=2.8.1->pandas>=0.18->altair) (1.16.0)
Note: you may need to restart the kernel to use updated packages.
gpdataframe5
=
dataframe6.dropna()
%
pip install altair vega_datasets
# Create the required bar plot of the number of apps in each Content Ratin
#(a) A bar plot of a number of apps stratified by each Content Rating cate
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
4/13/23, 9:24 PM
CVA Assignment no 8 (002703664) - Jupyter Notebook
localhost:8888/notebooks/CVA Assignment no 8 (002703664).ipynb
4/7
In [15]:
In [10]:
Out[15]:
import
altair as
alt
import
pandas as
pd
gpdataframe5 =
pd.read_csv(
r"C:\Users\adiik\Downloads\googleplaystore.csv"
content_ratings =
gpdataframe5[
'Content Rating'
].value_counts().reset_inde
content_ratings.columns =
[
'Content Rating'
, 'Count'
]
alt.Chart(content_ratings).mark_bar().encode(
x
=
'Content Rating:N'
,
y
=
'Count:Q'
).properties(width
=
200
)
#Create the required heatmap indicating the number of apps across the app
4/13/23, 9:24 PM
CVA Assignment no 8 (002703664) - Jupyter Notebook
localhost:8888/notebooks/CVA Assignment no 8 (002703664).ipynb
5/7
In [24]:
In [12]:
Out[24]:
import
altair as
alt
import
pandas as
pd
gpdataframe5 =
pd.read_csv(
r"C:\Users\adiik\Downloads\googleplaystore.csv"
bins =
[
0
, 1
, 2
, 3
, 4
, 5
]
labels =
[
'0-1'
, '1-2'
, '2-3'
, '3-4'
, '4-5'
]
gpdataframe5[
'Rating Bin'
] =
pd.cut(gpdataframe5[
'Rating'
], bins
=
bins, lab
chart =
alt.Chart(gpdataframe5).mark_rect().encode(
x
=
alt.X(
'Category:N'
),
y
=
alt.Y(
'Rating Bin:N'
),
color
=
alt.Color(
'count()'
, scale
=
alt.Scale(scheme
=
'greenblue'
), legend
).properties(width
=
600
)
chart
#Merge the code for the bar chart and the heatmap and create a visualizati
4/13/23, 9:24 PM
CVA Assignment no 8 (002703664) - Jupyter Notebook
localhost:8888/notebooks/CVA Assignment no 8 (002703664).ipynb
6/7
In [25]:
selected_category =
alt.selection(
type
=
"single"
, encodings
=
[
'x'
])
heatmap =
alt.Chart(gpdataframe5).mark_rect().encode(
alt.X(
'Category:N'
),
alt.Y(
'Rating:Q'
, bin
=
True
),
alt.Color(
'count()'
,
scale
=
alt.Scale(scheme
=
'greenblue'
),
legend
=
alt.Legend(title
=
'Total Apps'
)
)
).properties(
width
=
600
)
circles =
heatmap.mark_point().encode(
alt.ColorValue(
'grey'
),
alt.Size(
'count()'
,
scale
=
alt.Scale(domain
=
(
1
, 600
), range
=
(
1
, 200
)),
legend
=
alt.Legend(title
=
'Apps in Selection'
)
)
).transform_filter(
selected_category
)
bars =
alt.Chart(gpdataframe5).mark_bar().encode(
x
=
'Content Rating:N'
,
y
=
'count()'
,
color
=
alt.condition(selected_category, alt.ColorValue(
"steelblue"
), alt.Co
).properties(
width
=
200
).add_selection(selected_category)
heatmap +
circles |
bars
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
4/13/23, 9:24 PM
CVA Assignment no 8 (002703664) - Jupyter Notebook
localhost:8888/notebooks/CVA Assignment no 8 (002703664).ipynb
7/7
In [ ]:
Out[25]: