### K means clustering algorithm example using Python

K Means Clustering is an algorithm of Unsupervised Learning. You can apply this algorithm on datasets without labeled output data.Only Input data is there an we have a goal of finding regularities in data to group or cluster like items together.

You can copy the code an run it line by line in Jupyter Notebook.

Watch the videos given in the bottom of this post to understand the process clearly.

What is a Cluster – Datapoints aggregated together because of certain similarities

``` import numpy as np import matplotlib.pyplot as plt # Import the algorithm from scikitlearn https://scikit-learn.org from sklearn.cluster import KMeans # Get the dataset of wine https://archive.ics.uci.edu/ml/datasets/wine names = ['Class', 'Alcohol', 'Malic acid', 'Ash', 'Alcalinity of ash', 'Magnesium', 'Total phenols', \ 'Flavanoids', 'Nonflavanoid phenols', 'Proanthocyanins', 'Color intensity', 'Hue', 'OD280/OD315',\ 'Proline'] data = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data', names = names) data.head(100) data['Class'].value_counts().plot(kind='bar') data.plot.scatter(x = 'Alcohol', y = 'OD280/OD315', figsize=(8,5)) ```

``` data.plot.scatter(x = 'Alcohol', y = 'OD280/OD315', c= 'Class', figsize=(8,5), colormap='jet') data.iloc[:,[12,1]].head() # kmeans = Kmeans().fit(data) # kmeans = KMeans(n_clusters = 2) # kmeans.fit(X) # kmeans.cluster_centers_ # kmeans.labels_ kmeans = KMeans(n_clusters=3, init = 'random', max_iter = 1, random_state = 5).fit(data.iloc[:,[12,1]])```
``` centroids_df = pd.DataFrame(kmeans.cluster_centers_, columns = list(data.iloc[:,[12,1]].columns.values)) fig, ax = plt.subplots(1, 1) data.plot.scatter(x = 'Alcohol', y = 'OD280/OD315', c= kmeans.labels_, figsize=(12,8), colormap='jet', ax=ax, mark_right=False) centroids_df.plot.scatter(x = 'Alcohol', y = 'OD280/OD315', ax = ax, s = 80, mark_right=False) kmeans = KMeans(n_clusters=3, init = 'random', max_iter = 150, random_state = 5).fit(data.iloc[:,[12,1]]) centroids_df = pd.DataFrame(kmeans.cluster_centers_, columns = list(data.iloc[:,[12,1]].columns.values)) fig, ax = plt.subplots(1, 1) data.plot.scatter(x = 'Alcohol', y = 'OD280/OD315', c= kmeans.labels_, figsize=(12,8), colormap='jet', ax=ax, mark_right=False) centroids_df.plot.scatter(x = 'Alcohol', y = 'OD280/OD315', ax = ax, s = 80, mark_right=False) ```

What is K means clustering ?
You can watch the theory here :

Applying K means clustering on wine dataset :

### How to plot Boxplot in Python

A box plot is used to visualize 5 values in a dataset for the selected column(s):

• Minimum Value
• First Quartile or 25%
• Median (Second Quartile) or 50%
• Third Quartile or 75%
• Maximum value

Box Plot is also known as Box and Whisker Plot.

Steps –

1. Load the dataset using Pandas dataframe
1. Select any column to visualize
2. Plot boxplot using Pandas
OR
3. Plot boxplot using Seaborn

Python Code :

import pandas as pd

>> data.describe()

# In pandas boxplot one attribute, column is required to plot boxplot
# Column can take name of one column of the dataset or the list of columns
data.boxplot(column=[‘age’],figsize=[10,7])

# We can group data as well.

data.boxplot(column=[‘age’], by=[‘gender’], figsize=[10,7])

# Boxplot Using Seaborn Library

## मशीन लर्निंग क्या है

मशीन लर्निंग एक ऐसी तकनीक है जिसमे कंप्यूटर को इस तरह से प्रोग्राम किया जाता है की वो इनपुट डाटा के आधार पे खुद से आउटपुट डाटा को प्रेडिक्ट कर सके | दिए गए इनपुट के आधार पे खुद से सीख सके |
सॉफ्टवेयर डेवलपमेंट में जरुरत के आधार पे प्रोग्राम बनाया जाता है | मशीन लर्निंग में मशीन किसी इंसान की तरह आर्टिफिशियल इंटेलिजेंस का इस्तेमाल करके टास्क को खुद से करने की काबिलियत सीखती है |

मशीन लर्निंग आर्टिफिशियल इंटेलिजेंस विषय के अंदर आती है |

## मशीन लर्निंग के प्रकार –

• सुपरवाईस्ड लर्निंग
• अन्सुपरवाईस्ड लर्निंग
• रीइंफोर्स्मेंट लर्निंग

### Tableau Training in Lucknow

Tableau training is done by students and working professionals of Data Science industry.

Tableau is an easy to use tool to analyze data written in structured formats like JSON, Excel, CSV, XML, SQL etc.

Tableau is used to create interactive dashboards to visualize data in graphical and tabular form.

[email protected]

## Benefits of Tableau Course

1. Tableau is a simple and easy to learn software tool for data analytics.

2. If you are new to coding or you dont know coding at all, you can start working on Tableau immediately.

3. Tableau helps in quick, creative and interactive databases.

4. Tableau can handle large datasets easily.

5. Tableau does the work of detecting the datatype in spreadsheets automatically. Datatypes like Strings, Numeric Values, Geographical Values etc. can be easily visualized using Tableau.

### डाटा एनालिटिक्स क्या है

डाटा एनालिटिक्स दो शब्दों से मिल के बना है – डाटा का अर्थ है आंकड़े और एनालिटिक्स का अर्थ है विश्लेषण | डाटा एनालिटिक्स का क्या अर्थ हुआ – आंकड़ों का विश्लेषण |

### बिग डाटा क्या होता है ?

मार्केटिंग, रिसर्च और बिज़नस को बढाने के लिए जब आंकड़ों का विश्लेषण किया जाता है उसे डाटा एनालिटिक्स या बिग डाटा कहते हैं |

आंकड़ों को स्प्रेडशीट या टेबल में लिखना फिर उसको ग्राफ या चार्ट बना के विश्लेषण करना विश्लेषण करने के बाद प्राप्त की गयी जानकारी को सामान्य भाषा में लिख के देना जिससे की उसपर विचार करके उपयुक्त निर्णय लिया जा सकते | इस पूरी प्रक्रिया को डाटा एनालिटिक्स कहते हैं |

### डाटा एनालिटिक्स का प्रयोग कहा होता है ?

डाटा एनालिटिक्स का उपयोग प्रायः सभी व्यवसायों में होता है | डाटा एनालिटिक्स का प्रयोग करने वाले कुछ प्रमुख बिज़नस सेक्टर निम्नलिखित हैं  :

• मार्केटिंग
• स्वास्थ एवं फार्मा विभाग
• लोजिस्टिक्स के क्षेत्र में
• कृषि के क्षेत्र में
• खेल के क्षेत्र में
• सूचना एवं संचार के क्षेत्र में

### डाटा एनालिटिक्स का क्या लाभ है ?

डाटा एनालिटिक्स हमें अपने या हमारे क्लाइंट के व्यवसाय से जुडी हर ज़रूरी जानकारी देता है | इस जानकारी से हमें उन बातोँ का पता चलता है जो हमारे व्यवसाय को ऊपर की और ले जा रही हैं और उन बातोँ का भी पता चलता है जिसकी वजह से हमारे व्यवसाय को हानि हो रही है |

हम इन आंकड़ों की मदद से नए आईडिया सोच सकते हैं और अपने व्यवसाय को कामयाबी की तरफ ले जा सकते है |

### डाटा एनालिटिक्स के लिए किन टूल्स का प्रयोग किया जाता है ?

डाटा एनालिटिक्स के लिए निम्लिखित टूल्स का प्रयोग किया जाता है :

SQL डेटाबेस

R प्रोग्रामिंग लैंग्वेज

Python प्रोग्रामिंग लैंग्वेज

MS-Excel

### MBA HR Training in Lucknow

#### MBA HR Training in Lucknow – Human Resource Training in Lucknow

Slidescope Provides Practical and Job Oriented HR Training in Lucknow. We have a team of experienced professionals with 8 Years of experience in the field of Human Resource Management and HR Consulting. As a team we have conducted various campus recruitment.
As a consulting group, We have worked for many industries like:

• Real Estate
• FMCG
• Industrial Procurement
• Training and Educational Research
• Healthcare & Pharmaceuticals
• Tour And Travel
• Information Technology
We try to bring in the global work ethics and best practices.

## Key Elements of MBA HR Training

In our HR Training Module we provide hands on training on following modules:

1. Applications and Resume Management
2. Recruitment and Selection Management
3. Management of Payroll
4. Management of Welfare activities for employees
5. Management of Leaves and Attendance using HRM Software Application
6. Writing Business emails, Official Communication Letters and Content.
7. Excel Automation and Other Word Processing Tools like MS-Word.
8. Creation of Corporate Presentation using MS – PowerPoint and other online tools.
9. Basics of Data Analytics and Digital Marketing
10. Personality Development Program

Also, we provide summer internship training to the HR Management graduates who wish to seek managerial role and responsibility by getting themselves well equipped with the knowledge related to the HR domain. In this curriculum we provide the students an assistance to enhance the opportunity to be absorbed in their domain with utmost knowledge and confidence.

Practical HR Training, Project Reports formulation and Business communication are some of the value addition services included in this training. Above, all this we provide the students a valuable assistance in getting the right job since we have corporate tie ups at a pan India level.

Flexible timings for working professionals or students are available and personalized attention is ensured to each student to help them resolve their queries after every training session.

## Benefits of Corporate HR Training for MBA Students

Why should you train at Slidescope ?

• We’ve been in the recruitment industry for well over 5 years and are hiring for a lot of reputed brands, hence understand the industry requirements.
• Have the best of trainers for the same with practical experience.
• Will groom you into real professionals with an equal focus on course content and communication skills, also a very important part of this role.
• Will provide a Training Certificate for the same.

Who all can apply –

• Students or professionals looking to enter the HR domain.
• Those looking to refresh their knowledge gained earlier .
• Those from recruitment industry wanting to enter the Corporate sector as a HR Generalist.

## MBA HR Training Course Syllabus or Content

1.The Employee’s Provident Funds And Miscellaneous Provisions Act, 1952

2.The Employee’s State Insurance Act, 1948

3.The Payment Of Bonus Act, 1965

4.The Payment Of Gratuity Act, 1972

5.Payroll Processing – Salary Processing

6.Attendance And Leave

7.Payroll Software And Excel Practice

8.The Factories Act, 1948

9.The Shops And Commercial Establishment Act, 1962

10.The Minimum Wages Act, 1948

11.The Payment Of Wages Act, 1936

12.Employee’s Compensation Act, 1923

13.The Maternity Benefit Act, 1961

14.The Contract Labour (Regulation & Abolition) Act, 1970

15.The Industrial Disputes Act, 1947

### HR CORE PRACTICAL PRACTICE MODULE

1.Joining & Exit Formalities

2.Recruitment

3.Employee Engagement

4.Employee Relations

5.Performance Management System

6.Training & Development

7.Attrition And Retention

8.Competency Mapping

### How is the MBA HR training helpful and where is it applicable ?

The HR Training program will help you understand the nuances and the importance of the HR’s role in an Organisation. Also, it makes one  aware of the applicable laws. It is applicable for all sectors and industries including Services  but more so for the Manufacturing sector.

### What is the fee for the program ?

Please talk to our counsellors for the  same.  It’ll be very competitive or lesser than most other Institutes are offering in the city, even while the program will be richer in content and more in-depth to ensure you’re at ease when you join an Organisation.  We’ve got experienced faculty to ensure you the best Training experience and a good job at the end of the program.

You Can Call Us – +91-980798789, 9454241494, 9696820568

Or You can simply use the Chat Box on the bottom right corner of this page.

Facebook Insights to Google Data Cloud Studio has been live for some time and it has some amazing features.

Google Data Studio can be used to fetch data from other sources.

We will guide you step by step how to create stunning Graph and Chart Reports using Google Data Cloud.

Step 1 – Click on Start a New Report.

Step – 2 Click on Create New Data Source

Step – 3  Go to the Connectors panel on the left Sidebar

Step – 4 Click on Explore Connectors

You will see many Data Sources here that will be listed alphabetically. Like – Adobe Analytics, Adwords etc.

Here you have to look for Facebook Insights

After Clicking Facebook Insights it will appear in the left Connectors Sidebar.

You will see a message – Data Studio requires authorization to use this community connector.

Click on Authorize Button.

You have to select Facebook Insights by Supermetrics.

Next you will see this message

Facebook Insights requires authorization to connect to data.

You will be asked to select pages. You can select one page or select all using the check boxes.

You will see a list of selected Pages.

Now click on CONNECT in the top right corner.

In the next screen you will see fields that you can select for detailed report.

Now you have to click ADD To Reports

You will see a popup and here also you have to click add to reports.

Once all the data is loaded you will be able to customize the reports and analyze it at one place. You can also show these reports to your clients.

Entrepreneurs who are planning to bring their business online or those who want to start a new online business will find this article helpful in understanding some necessary steps and facts.

Here the term online represents Internet. Online business primarily focuses on targeting users on Internet as their potential customers.

If you are planning to build a website or a mobile app to earn profits then your business can be called an online business.

Majority of Internet Users are active on mobile and desktop equally. Statistics from past couple of years are showing that users of smartphones are increasing at a rapid rate.

We conducted a study on our clients (to whom we are offering digital marketing services) and found that business which are targeting users in the age group 18 – 35 are getting 83% of their visitors from mobile devices. It is an Acting Institute.

Some companies are targeting users in Age Group 40 – 55 are getting 65% of visitors from Desktop devices.

New companies can considers these statistics to understand that knowing your customer’s demographic info is very important for selecting a platform like desktop or mobile.

If you are primarily focusing on developing a mobile app then you should analyze that the customer group you are targeting is familiar and comfortable using mobile apps or not.

An app like Whatsapp is used by people of all age groups because the interface is very easy to understand and the app is very useful in daily conversations but the majority of users on Whatsapp belong to the age group 18-35.

It is always good to have a basic website of your organization to provide information of your company.

A Responsive Website works smoothly on Mobile Phones, Tablets and Desktop PC.

For Bloggers and Content Writers

If your website’s primary motive is to provide useful articles and content on specific topics then a responsive website will be sufficient.  Users will be able to find your articles easily by querying on Search Engines. You can go for Search Engine Optimization, Social Media Marketing and Search Engine Marketing for getting good amount of traffic to your website.

Get a Payment Gateway

A Payment gateway is necessary to receive online payments. Payment Gateway Integration lets user to pay online using Credit Card, Debit Card or Netbanking.

Some payment gateway companies offer payment gateway to registered business owners with current account of company only.

Some payment gateway companies like Paypal or Payumoney offer services for Individuals also.

A payment gateway account is connected to your bank account. When a user makes payment the money is transferred to pg’s account and later transferred to your bank account after deduction of commission or currency conversion is some cases.

### What is Macro Environment ?

Reference – Slideshare

Every business has an aim of improving its performance by fundamental and creative strategies. There are certain factors affecting the decision making capabilities of an organization and  these factors  can not be controlled.

You can refer to the slides given above and the points mentioned in those slides along-with some examples to understand Macro Environment in depth.

• 2. MACRO ENVIRONMENT • The major external and uncontrollable factors that influence an organization’s decision making, and affect its performance and strategies. These factors include the economic factors; demographics; legal, political, and social conditions; technological changes; and natural forces. • Specific examples of macro environment influences include competitors, changes in interest rates, changes in cultural tastes, disastrous weather, or government regulations.
• 3. FORCES IN COMPANY’S MACRO ENVIRONMENT
• 4. DEMOGRAPHIC ENVIRONMENT • Demography is the study of human populations in term of sizes, density, location, age, gender, race, occupation, and other statistics. The demographic environment is a major interest to marketers because it involves people, and people make up markets.
• 5. ECONOMIC ENVIRONMENT • The economic environment consist of factors affecting consumers purchasing power and spending patterns both across and within their world markets.
• 6. NATURAL ENVIRONMENT •The natural environment involves the natural resources that are needed as inputs by marketers or that are affected by marketing activities.
• 7. TECHNOLOGICAL ENVIRONMENT • The technological environment is perhaps the most dramatic force now shaping our destiny. Forces that create new technologies, create new product and market opportunities.
• 8. POLITICAL ENVIRONMENT • The political environment consist of laws, government agencies, and pressure groups that influence and limit various organizations and individuals in the given society.
• 9. CULTURAL ENVIRONMENT • The cultural environment is made up of institutions and other forces that affect a society’s basic values, perceptions, preferences, and behaviors.
• 10. CASE STUDY ON RELIANCE INDUSTRIES • Reliance Industries Limited (RIL) is an Indian conglomerate holding company headquartered in Mumbai, Maharashtra, India. The company operates in five major segments: exploration and production, refining and marketing, petrochemicals, retail and telecommunications. • The group is present in many business sectors across India including petrochemicals, construction, communications, energy, health care, science and technology, natural resources, retail, textiles, and logistics. • RIL is the second-largest publicly traded company in India by market capitalization and is the second largest company in India by revenue after the state-run Indian Oil Corporation. The company is ranked No. 99 on the Fortune Global 500 list of the world’s biggest corporations, as of 2013.RIL contributes approximately 14% of India’s total exports.
• 11. Is Mukesh Ambani falling out with the Narendra Modi government? Mukesh and Reliance Industries Ltd (RIL) have been at the receiving end of a couple of “strong” government decisions — the biggest one being to keep gas price hike in abeyance. UPA-II had set April 1 as the date for the hike, but left it to the next government to take a final decision later. “It was expected that no sooner does Narendra Modi come to power, the hike would be announced. But that has not happened, giving the first indication that all was not well between Mukesh and the government,” said a source in the BJP. Sources also speculate that the government may be buying time before helping RIL. An e-mail sent to RIL late evening did not elicit any response. “It is too short a notice,” said the spokesperson. That has not happened in the first 45 days of Modi’s rule. This is being read as proof of a “rift between RIL and the Modi government”. That Reliance decided to hit back by deferring investments in fresh fields like the R-cluster in KG-D6 Block is also being taken as proof of a “fall from grace’ for RIL and Mukesh Ambani. A second reason, cited by sources in the BJP, for the alleged fallout between Mukesh and the government is linked to the CAG reports on 2G that indicated that RIL had rigged conditions in its favour to bag the 4G contract, and which it used to launder money. There is an AAP angle to this allegation, too. Supreme Court lawyer and AAP member Prashant Bhushan has filed a petition for the cancellation of RIL’s 4G deal. Coming in handy for Bhushan was the Modi government’s decision to bring back black money stashed away abroad in six months, for which the government set up a special investigation team (SIT).
• 12. The AAP troubleshooter forwarded a loaded letter to SIT on Black Money, alleging that Mukesh Ambani was a common money launderer, who used the 4G contract route to turn black money to white. “Reliance is laundering its ill-gotten profits from KG Basin through Singapore and depositing the same into accounts of Mr. Mukesh Ambani,” Bhushan wrote in his letter to ML Meena, member secretary, SIT on Black Money. “There have been two detailed CAG reports that says RIL is involved in inflation of capital expenditure, over-invoicing and siphoning of money from the KG Basin D6 Block. There is clear indication that such amounts are being laundered and funneled back into Reliance companies,” he said. The latest proof that RIL and the Modi government are not on the same page and that Modi will not go out of his way to smoothen things out for RIL is the \$579million fine the government has slapped on RIL for continuous shortfall in KG Basin gas production. Gas price hike deferment led RIL and its other partners in KG-D6 basin Niko Resources and British Petroleum to file arbitration against the government, which many considered as an arm-twisting exercise. Nonetheless, the new government has made it amply clear over the last two months through various announcements that it is not in favour of a sharp rise in gas price.. The oil ministry also slapped an additional penalty of \$579 million for natural gas production shortfall from KG-D6 block for the financial year 2013- 14. The penalty in the form of disallowing costs incurred on the field is for missing the target in 2013-14. With this, the total costs disallowed to RIL will increase to \$2.375 billion. Another recent document which was passed by oil ministry to the cabinet committee also indicated that RIL should not be allowed new gas price for KG-D6 produce until it is able to meet the shortfall in gas output over the last four years.