AMCCATALAN DS Python Summative
AMCCATALAN DS Python Summative
Notebook)
Instructions
Answer each line item by replacing the blanks with the necessary operator or a value. Make sure
the kernel is set to Python 3** Once done, right click the actual notebook page and print as PDF.
Last part of the notebook is the code for timestamp from your computer - Run it!.
pokemon.shape
#get the shape of the dataset
(801, 8)
pokemon.head(10)
#complete the syntax to disply the first 10 rows of the record.
p_published p_stamina
0 YES 10
1 YES 5
2 NO 5
3 YES 1
4 NO 3
5 NO 1
6 NO 5
is_legendary 0 1
p_generation
1 20.0 7.1
2 12.9 8.6
3 17.1 14.3
4 12.9 18.6
5 19.6 18.6
6 9.0 8.6
7 8.6 24.3
# then using the percentage data, create a subset for each element of
the overlay
# is legendary overlay generation
pok_y = pokemon[pokemon.is_legendary == 0]['p_generation']
pok_n = pokemon[pokemon.is_legendary == 1]['p_generation']
# determin upper and lower bounds of each bin (use the number of bins)
is_legendary 0 1
VAR
Under 50 200 17
50 to 75 89 5
75 to 100 95 5
Over 100 347 43
# then plot a binned bar graph of the crosstab data based on VAR
(frequency)
crosstab_02.plot(kind='bar', stacked=True, title='Bar Graph of VAR
(Binned / Frequency) with Response Overlay')
# then plot a binned bar graph of the crosstab data based on VAR
(normalized)
crosstab_02_norm.plot (kind='bar', stacked = True, title = 'Bar Graph
of VAR (Binned / Proportion) with Response Overlay')
import datetime
import socket
def get_Host_name_IP():
try:
host_name = socket.gethostname()
host_ip = socket.gethostbyname(host_name)
print("Hostname-7:",host_name)
print("IP Address:",host_ip)
except:
print("No visible IP Address")
get_Host_name_IP()
now = datetime.datetime.now()
print ("Time Stamp:", now.strftime("%Y-%m-%d %H:%M:%S"))
Hostname-7: AMCCATALAN
IP Address: 192.168.0.115
Time Stamp: 2023-09-16 18:21:21