Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to detect outliers using plotly in python?

Description

To create box plot to detect the outliers in a data set variable.

Process

   Read the data set.

  Scaling the feature variables.

   Initialize the box plot object form plotly library.

   Declare the plotting variables.

   Pass it into the go.box(variable).

   Use py.iplot(variable) to create the box plot.

   Box plot used to detect the outliers attributes in a variable.

Sample Code

#import plotly library

import plotly.plotly as py

import plotly.graph_objs as go

#import pandas library

import pandas as pd

#read the data set

data=pd.read_excel(‘/home/soft23/soft23/
Sathish/Pythonfiles/flyer.xlsx’)

df=pd.DataFrame(data)

#declare the variable

y0 = df[‘FlyingReturnsMiles’]

#assign into box plot object

trace0 = go.Box(y=y0)

#store it in a variable

#because plotting object takes 1 argument only

data1 = [trace0]

#plotting the variable

py.iplot(data1)

Source code(Two variable):

#import plotly library

import plotly.plotly as py

import plotly.graph_objs as go

#import pandas library

import pandas as pd

#read the data set

data=pd.read_excel(‘/home/soft23/soft23/http://slogix.in/
Sathish/Pythonfiles/flyer.xlsx’)

df=pd.DataFrame(data)

#declare the variable

y0 = df[‘FFP#’]

y1 = df[‘EnrollDuration’]

#assign into box plot object

trace0 = go.Box(y=y0)

trace1 = go.Box(y=y1)

#store it in a variable

#because plotting object takes 1 argument only

data1 = [trace0,trace1]

py.iplot(data1)

Screenshots
To detect outliers using plotly in python
Scaling the feature variables