Welcome to the Simplilearn Community

Want to join the rest of our members? Sign up right away!

Sign Up

DataScience with Python|Harish|Feb 8-Feb 24

Suman Basu

Moderator
Alumni
Customer
Hi Team,

Kindly find this forum for your Data Science with Python discussion.

Thanks and regards,
Simplilearn
 

_87224

Member
i have installed Anaconda from IT services.
I can see navigator , but no idea how open python editor to write program.

Opened jupyter note, it shows as below. Any suggestion on what to do open editor for Python code.
1613144193611.png
 

_85072

Member
i have installed Anaconda from IT services.
I can see navigator , but no idea how open python editor to write program.

Opened jupyter note, it shows as below. Any suggestion on what to do open editor for Python code.
View attachment 14027



I think you have opened Jupyter Notebook. From here you can browse your files.
To write code please open Jupyter Lab.

From there you can start coding.
 
Practice Project NumPy: Analyse GDP of Countries

countries = ['Algeria','Angola','Argentina','Australia','Austria','Bahamas','Bangladesh',
'Belarus','Belgium','Bhutan','Brazil','Bulgaria','Cambodia','Cameroon','Chile',
'China','Colombia','Cyprus','Denmark','El Salvador','Estonia','Ethiopia',
'Fiji','Finland','France','Georgia','Ghana','Grenada','Guinea','Haiti',
'Honduras','Hungary','India','Indonesia','Ireland','Italy','Japan','Kenya',
'South Korea','Liberia','Malaysia','Mexico', 'Morocco','Nepal','New Zealand',
'Norway','Pakistan', 'Peru','Qatar','Russia','Singapore','South Africa',
'Spain','Sweden','Switzerland','Thailand', 'United Arab Emirates','United Kingdom',
'United States','Uruguay','Venezuela','Vietnam','Zimbabwe']

gdp = [2255.225482,629.9553062,11601.63022,25306.82494,27266.40335,19466.99052,
588.3691778,2890.345675,24733.62696,1445.760002,4803.398244,2618.876037,
590.4521124,665.7982328,7122.938458,2639.54156,3362.4656,15378.16704,
30860.12808,2579.115607,6525.541272,229.6769525,2242.689259,27570.4852,
23016.84778,1334.646773,402.6953275,6047.200797,394.1156638,385.5793827,
1414.072488,5745.981529,837.7464011,1206.991065,27715.52837,18937.24998,
39578.07441,478.2194906,16684.21278,279.2204061,5345.213415,6288.25324,
1908.304416,274.8728621,14646.42094,40034.85063,672.1547506,3359.517402,
36152.66676,3054.727742,33529.83052,3825.093781,15428.32098,33630.24604,
39170.41371,2699.123242,21058.43643,28272.40661,37691.02733,9581.05659,
5671.912202,757.4009286,347.7456605]

import numpy as np

np_countries = np.array(countries)
np_countries
np_gdp = np.array(gdp)
np_gdp

np_countries.shape, np_gdp.shape
((63,), (63,))

## Find and print the name of the country with the highest GDP ##
np_gdp.max()
40034.85063
np_gdp.argmax()
45
print(np_countries[45])
Norway

## Find and print the name of the country with the lowest GDP ##
np_gdp.min()
229.6769525
np_gdp.argmin()
21
print(np_countries[21])
Ethiopia

## Print out text and input values iteratively ##
for val1, val2 in zip(np_countries, np_gdp):
print(val1, val2)

Algeria 2255.225482
Angola 629.9553062
Argentina 11601.63022
Australia 25306.82494
Austria 27266.40335
Bahamas 19466.99052
Bangladesh 588.3691778
Belarus 2890.345675
Belgium 24733.62696
Bhutan 1445.760002
Brazil 4803.398244
Bulgaria 2618.876037
Cambodia 590.4521124
Cameroon 665.7982328
Chile 7122.938458
China 2639.54156
Colombia 3362.4656
Cyprus 15378.16704
Denmark 30860.12808
El Salvador 2579.115607
Estonia 6525.541272
Ethiopia 229.6769525
Fiji 2242.689259
Finland 27570.4852
France 23016.84778
Georgia 1334.646773
Ghana 402.6953275
Grenada 6047.200797
Guinea 394.1156638
Haiti 385.5793827
Honduras 1414.072488
Hungary 5745.981529
India 837.7464011
Indonesia 1206.991065
Ireland 27715.52837
Italy 18937.24998
Japan 39578.07441
Kenya 478.2194906
South Korea 16684.21278
Liberia 279.2204061
Malaysia 5345.213415
Mexico 6288.25324
Morocco 1908.304416
Nepal 274.8728621
New Zealand 14646.42094
Norway 40034.85063
Pakistan 672.1547506
Peru 3359.517402
Qatar 36152.66676
Russia 3054.727742
Singapore 33529.83052
South Africa 3825.093781
Spain 15428.32098
Sweden 33630.24604
Switzerland 39170.41371
Thailand 2699.123242
United Arab Emirates 21058.43643
United Kingdom 28272.40661
United States 37691.02733
Uruguay 9581.05659
Venezuela 5671.912202
Vietnam 757.4009286
Zimbabwe 347.7456605

## Print out the entire list of the countries with their GDPs ##
countries_gdp = dict(zip(countries, gdp))
print(countries_gdp)
np_countries_gdp = np.array(countries_gdp)
np_countries_gdp

array({'Algeria': 2255.225482, 'Angola': 629.9553062, 'Argentina': 11601.63022, 'Australia': 25306.82494, 'Austria': 27266.40335, 'Bahamas': 19466.99052, 'Bangladesh': 588.3691778, 'Belarus': 2890.345675, 'Belgium': 24733.62696, 'Bhutan': 1445.760002, 'Brazil': 4803.398244, 'Bulgaria': 2618.876037, 'Cambodia': 590.4521124, 'Cameroon': 665.7982328, 'Chile': 7122.938458, 'China': 2639.54156, 'Colombia': 3362.4656, 'Cyprus': 15378.16704, 'Denmark': 30860.12808, 'El Salvador': 2579.115607, 'Estonia': 6525.541272, 'Ethiopia': 229.6769525, 'Fiji': 2242.689259, 'Finland': 27570.4852, 'France': 23016.84778, 'Georgia': 1334.646773, 'Ghana': 402.6953275, 'Grenada': 6047.200797, 'Guinea': 394.1156638, 'Haiti': 385.5793827, 'Honduras': 1414.072488, 'Hungary': 5745.981529, 'India': 837.7464011, 'Indonesia': 1206.991065, 'Ireland': 27715.52837, 'Italy': 18937.24998, 'Japan': 39578.07441, 'Kenya': 478.2194906, 'South Korea': 16684.21278, 'Liberia': 279.2204061, 'Malaysia': 5345.213415, 'Mexico': 6288.25324, 'Morocco': 1908.304416, 'Nepal': 274.8728621, 'New Zealand': 14646.42094, 'Norway': 40034.85063, 'Pakistan': 672.1547506, 'Peru': 3359.517402, 'Qatar': 36152.66676, 'Russia': 3054.727742, 'Singapore': 33529.83052, 'South Africa': 3825.093781, 'Spain': 15428.32098, 'Sweden': 33630.24604, 'Switzerland': 39170.41371, 'Thailand': 2699.123242, 'United Arab Emirates': 21058.43643, 'United Kingdom': 28272.40661, 'United States': 37691.02733, 'Uruguay': 9581.05659, 'Venezuela': 5671.912202, 'Vietnam': 757.4009286, 'Zimbabwe': 347.7456605},
dtype=object)

## Print the highest GDP value, lowest GDP value, mean GDP value, standardized GDP value, and the sum of all the GDPs ##
np_gdp.max()
40034.85063
np_gdp.min()
229.6769525
np_gdp.mean()
11289.409271639683
np_gdp.std()
12743.828910617945
np.sum(np_gdp)
711232.7841133

@harish joya , Can you please check once if I have analyzed correctly?
 

_87224

Member
Hi, this is regarding Movielens project. i have created Logistic Regression model, but accuracy is very low , i.e. 0.34944661621059575. what to do in this scenario? - Venkat
 
Top