Ibromodzi's Posts
Nairaland Forum › Ibromodzi's Profile › Ibromodzi's Posts
1 2 3 4 5 6 7 8 9 10 11 (of 11 pages)
You are good to go |
Please how can I get my account approved? |
ibromodzi:Problem solved. Thanks! |
stanliwise:I have stated it in my intro, the error is: DataFrame object is not callable when I tried to execute the last four lines of the code i.e # Create two new dataframes which are subsets of the original data Europe = un(un['Continent'] == 'Europe') Europe.reset_index(inplace = True) NorthAmericaa = un(un['Continent'] == 'North America') |
Hello great programmers, I'm new to pandas so I just downloaded this data set from Kaggle.com to practice with. However the program throws an error saying Object DataFrame is not callable. The dataset can be found here. Here is the code import pandas as pd import numpy as np import researchpy as rp import scipy.stats import matplotlib.pyplot as plt un = pd.read_csv(r"C:\Users\ibrom\Documents\SAMPLE DATASET\Military Expenditure.csv" ![]() #To know the country with highest spending #first create a new column with total spending over the years un['Total Spending'] = un.iloc[:, 5:64].sum(axis=1) #sorting values to know the country with the highest and least spending un.sort_values('Total Spending', ascending = False) #filtering based on Type of region man = rp.summary_cat(un['Type']) man.reset_index() #grouyping the countries into continents and assessing their military spending over the year def continent(country): if country in ('Algeria','Angola','Benin','Botswana','Burkina Faso','Burundi', 'Cabo Verde','Cameroon', 'Central African Republic','Chad','Comoros', 'Congo, Democratic Republic of the','Congo, Republic of the','Cote d\'Ivoire','Djibouti','Egypt', 'Equatorial Guinea','Eritrea','Eswatini',' Ethiopia', 'Gabon','Gambia','Ghana', 'Guinea',"Guinea-Bissau", 'Kenya', 'Lesotho', 'Liberia', 'Libya', 'Madagascar', 'Malawi', 'Mali', 'Mauritania', 'Mauritius', 'Morocco', 'Mozambique', 'Namibia', 'Niger', 'Nigeria', 'Rwanda', 'Sao Tome and Principe' 'Senegal', 'Seychelles', 'Sierra Leone', 'Somalia', 'South Africa', 'South Sudan', 'Sudan', 'Tanzania', 'Togo', 'Tunisia', 'Uganda', 'Zambia', 'Zimbabwe'): return "Africa" elif country in ('Afghanistan', 'Armenia', 'Azerbaijan', 'Bahrain', 'Bangladesh', 'Bhutan', 'Brunei' 'Cambodia', 'China', 'Cyprus', 'Georgia' 'India' 'Indonesia' 'Iran' 'Iraq', 'Israel' 'Japan Jordan', 'Kazakhstan', 'Kuwait', 'Kyrgyzstan', 'Laos','Lebanon', 'Malaysia', 'Maldives', 'Mongolia', 'Myanmar (formerly Burma)', 'Nepal','North Korea', 'Oman', 'Pakistan', 'Palestine', 'Philippines', 'Qatar', 'Russia', 'Saudi Arabia', 'Singapore', 'South Korea', 'Sri Lanka', 'Syria', 'Taiwan', 'Tajikistan', 'Thailand', 'Timor-Leste','Turkey','Turkmenistan', 'United Arab Emirates (UAE)', 'Uzbekistan', 'Vietnam', 'Yemen, Rep'): return "Asia" elif country in ('Albania', 'Andorra', 'Armenia', 'Austria', 'Azerbaijan', 'Belarus', 'Belgium', 'Bosnia and Herzegovina', 'Bulgaria', 'Croatia', 'Cyprus', 'Czechia', 'Denmark', 'Estonia', 'Finland', 'France', 'Georgia', 'Germany', 'Greece', 'Hungary', 'Iceland', 'Ireland', 'Italy', 'Kazakhstan', 'Kosovo', 'Latvia', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Malta', 'Moldova', 'Monaco', 'Montenegro', 'Netherlands', 'North Macedonia', 'Norway', 'Poland', 'Portugal','Romania' 'Russia' 'San Marino' 'Serbia', 'Slovakia', 'Slovenia', 'Spain', 'Sweden', 'Switzerland', 'Turkey', 'Ukraine', 'United Kingdom', 'Vatican City'): return "Europe" elif country in ('Antigua and Barbuda', 'Bahamas', 'Barbados', 'Belize Canada', 'Costa Rica', 'Cuba', 'Dominica Dominican Republic', 'El Salvador', 'Grenada', 'Guatemala', 'Haiti', 'Honduras', 'Jamaica', 'Mexico', 'Nicaragua', 'Panama', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Vincent and the Grenadines', 'Trinidad and Tobago', 'United States'): return "North America" elif country in ('Argentina', 'Bolivia', 'Brazil', 'Chile', 'Colombia', 'Ecuador', 'Guyana', 'Paraguay', 'Peru', 'Suriname', 'Uruguay', 'United States', 'Venezuela'): return "South America" elif country in ('Australia', 'Fiji', 'Kiribati', 'Marshall', 'Islands', 'Micronesia', 'Nauru', 'New Zealand', 'Palau', 'Papua New Guinea', 'Samoa', 'Solomon Islands', 'Tonga', 'Tuvalu', 'Vanuatu'): return "Australia / Oceania" # Creating the new column for continent un['Continent'] = un['Name'].apply(continent) # Create two new dataframes which are subsets of the original data Europe = un(un['Continent'] == 'Europe') Europe.reset_index(inplace = True) NorthAmericaa = un(un['Continent'] == 'North America') |
Do you have for hp elite book mini? And can I get it in Ilorin? |
You are doing a good job. I'm still in the process of learning data analysis. I'll soon go into Machine Learning. |
Ejiod:Boss please is it possible to analyze likert scale data with python? If not what's the best way to do it? |
I'm happy reading about bosses' narratives here. Really inspiring. Well, I started learning python last month and due to my experience with C++, I was able to learn with the speed of light Lol. So far I've mastered Numpy,Pandas, Matplotlib and a bit of Scipy, StatsModel and seaborn. I handled a mini project last week (a 'pseudo analysis' though, if there's anything like that) where I needed to read an excel file, make some analysis and visualize the results. It was really interesting working with the project. I'm currently delving into inferential statistics and I'll move on to machine learning later. I'll be glad if bosses here can guide me into a more distinctive path because I learn everything myself. Python is indeed powerful |
081644029222 |
08164402922 |
08164402922 |
imitateMe:What a dumb assertion! We have many Nigerians who are crypto developers, say only what you know. |
isthatso: |
Redeakaa:Nah |
Almunjid:That's the fact bro... |
Redeakaa:Wow... I stay in Badariya |
Redeakaa:Where do you stay in Kebbi? |
Durentt:There are five first class students in my class including myself with the first two being females. These girls are so accurate and precise when they answer questions, thus they tend to score higher marks. This always got me thinking and I would ask myself what's so extraordinary in them but I later got to find these; They don't joke with note taking in class which I am always lackadaisical about (since all our notes are in power points). They do their assignments the first day the lecturer gives them(as for me, I don't take assignments serious untill the last minutes). They do listen in class attentively( I don't usually care about this since the notes will be given out at the end of the classes) They are always the most active whenever they find themselves working in a group. Apart from these, I do read a lot because that's like a hobby to me. My CGPA was growing steadily from 100 level not until I tried to involve myself in a relationship in 400level first semester and this affected my result(I managed to have three As which was very rare of me), immediately I realized this I tightened my belt and made up for it in second semester, though my G.p fell from 4.62 to 4.57. Now in 500L My tactics; Whenever I'm reading for tests or exams, I do read the lecturer's mind(trying to make a mental map of the questions the lecturer is likely to ask). I do this carefully by rewriting the notes(no matter how bulky) in a jotter and revising it many times. |
SouthEastFacts:Oga you know nothing about Kwara for spewing this trash. |
grossintel:I get you. Like a voting system running on the blockchain |
08164402922 Please add |
Is it true that she's kleptomaniac? |
08164402922 Add please |
greatface:Ok I will |
greatface:I'll try this out |
Ikennablue:Pm sent |
ItrendNaija:Lol |
rapthugx:I understand |
Ikennablue:Wow! I'll like to know more about this. Can I send you a pm? |
Towbaba500:Thanks but the question is how far can one go with these apps. I used to practice with cppdroid but had to stop because of my perceived limitations. For example, you can't make app with it |

