<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: muradalhasan</title>
    <description>The latest articles on DEV Community by muradalhasan (@muradalhasan).</description>
    <link>https://dev.to/muradalhasan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F973009%2F900c2f7c-9a74-48a3-b222-14f3b9900e61.png</url>
      <title>DEV Community: muradalhasan</title>
      <link>https://dev.to/muradalhasan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muradalhasan"/>
    <language>en</language>
    <item>
      <title>Seaborn-High Level Graphical Representation</title>
      <dc:creator>muradalhasan</dc:creator>
      <pubDate>Tue, 15 Aug 2023 09:54:14 +0000</pubDate>
      <link>https://dev.to/muradalhasan/seaborn-high-level-graphical-representation-167d</link>
      <guid>https://dev.to/muradalhasan/seaborn-high-level-graphical-representation-167d</guid>
      <description>&lt;p&gt;Data visualization library based on Matplotlib. Provides High Level Graphical Interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import seaborn as sns
import matplotlib.pyplot as plt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  loading dataset,# draw lineplot,# setting the x limit of the plot# # changing the theme to dark
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
sns.lineplot(x="sepal_length", y="sepal_width", data=data)
plt.xlim(5)
sns.set_style("dark")
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;figure() method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
plt.figure(figsize = (4, 4))
sns.lineplot(x="sepal_length", y="sepal_width", data=data)
sns.despine()
plt.show()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  set_context() method
&lt;/h2&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  set_context(context=None, font_scale=1, rc=None)
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
sns.lineplot(x="sepal_length", y="sepal_width", data=data)
sns.set_context("poster")
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*Subplot Already Discued in Matplotlib&lt;/p&gt;

&lt;h1&gt;
  
  
  Relational Plots--&amp;gt;Relational plots are used for visualizing the statistical relationship between the data points
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  seaborn.relplot(x=None, y=None, data=None, **kwargs)
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
sns.relplot(x='sepal_width', y='species', data=data)

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Scatter Plot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  seaborn.scatterplot(x=None, y=None, data=None, **kwargs)
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
sns.scatterplot(x='sepal_length', y='sepal_width', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Line Plot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  seaborn.lineplot(x=None, y=None, data=None, **kwargs)
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
sns.lineplot(x='sepal_length', y='species', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Bar Plot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  barplot([x, y, hue, data, order, hue_order, …])
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
sns.barplot(x='species', y='sepal_length', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Count Plot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  countplot([x, y, hue, data, order, …])
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")

sns.countplot(x='species', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Box Plot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  # boxplot([x, y, hue, data, order, hue_order, …])
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")

sns.boxplot(x='species', y='sepal_width', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Violinplot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  violinplot([x, y, hue, data, order, …]
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")

sns.violinplot(x='species', y='sepal_width', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Stripplot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  stripplot([x, y, hue, data, order, …])
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")

sns.stripplot(x='species', y='sepal_width', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Swarmplot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  swarmplot([x, y, hue, data, order, …])
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")

sns.swarmplot(x='species', y='sepal_width', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Histogram
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  histplot(data=None, *, x=None, y=None, hue=None,  **kwargs)
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")

sns.histplot(x='species', y='sepal_width', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Distplot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  distplot(a[, bins, hist, kde, rug, fit, …])
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")

sns.distplot(data['sepal_width'])
plt.show()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Jointplot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  jointplot(x, y[, data, kind, stat_func, …])
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
sns.jointplot(x='species', y='sepal_width', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Pairplot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  pairplot(data[, hue, hue_order, palette, …])
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
sns.pairplot(data=data, hue='species')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Rugplot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  rugplot(a[, height, axis, ax])
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
sns.rugplot(data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  KDE Plot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  seaborn.kdeplot(x=None, *, y=None, vertical=False, palette=None, **kwargs)
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("iris")
sns.kdeplot(x='sepal_length', y='sepal_width', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Regression Plots
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  seaborn.lmplot(x, y, data, hue=None, col=None, row=None, **kwargs)
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("tips")
sns.lmplot(x='total_bill', y='tip', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Regplot
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  seaborn.regplot( x,  y,  data=None, x_estimator=None, **kwargs)
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("tips")
sns.regplot(x='total_bill', y='tip', data=data)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Heatmap
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Syntax:
&lt;/h1&gt;

&lt;h1&gt;
  
  
  seaborn.heatmap(data, *, vmin=None, vmax=None, cmap=None, center=None, annot_kws=None, linewidths=0, linecolor=’white’, cbar=True, **kwargs)
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = sns.load_dataset("tips")
# correlation between the different parameters
tc = data.corr()
sns.heatmap(tc)
plt.show()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Matplotlib</title>
      <dc:creator>muradalhasan</dc:creator>
      <pubDate>Wed, 02 Aug 2023 13:54:08 +0000</pubDate>
      <link>https://dev.to/muradalhasan/matplotlib-pe3</link>
      <guid>https://dev.to/muradalhasan/matplotlib-pe3</guid>
      <description>&lt;p&gt;Matplotlib is a low level graph plotting and open source library was created by John D. Hunter.There are two types of method to creat a matplotlib plot functional and Object oriented method.&lt;br&gt;
*To plot a function we need two array of ponits and plot() function then show() function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xpoints = [0, 6]
ypoints = [0, 120]

plt.plot(xpoints, ypoints)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and it will plot a graph according to x-ponits and y-pointes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;size(ms),marker_color(mec),ful_marker_color(mec),linestyle,
linewidth teg of plot function
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ypoints = np.array([3, 8, 1, 10])

plt.plot(ypoints, marker = 'o',color="hotpink", ms = 20,mec="yellow",mfc="blue",linestyle="--",linewidth=10)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;marker function mark the satisfied points&lt;br&gt;
color function gives color of lines&lt;br&gt;
ms decide the size&lt;br&gt;
mec decide the marker circle color&lt;br&gt;
mfc decide marker color&lt;br&gt;
linestyle decides linestyle&lt;br&gt;
linewidth decides linewidth of line&lt;br&gt;
*lebeling the axis and plot title&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125])
y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330])

plt.plot(x, y)
plt.title("This is an example title",color='red',size=20,loc='right')
plt.xlabel("Average Pulse",color='blue',size=20,family='serif')
plt.ylabel("Calorie Burnage",color='yellow',size=20,family='serif')

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*grid() functionn and it's attributes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.grid(axis='x')
plt.show()

plt.grid(color = 'green', linestyle = '--', linewidth = 0.5)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*subplot function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.subplot(2, 3, 1)
plt.plot(x,y)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2 in subplot means 2 rows and 3 column and position of that subplot  is 1&lt;br&gt;
*scatter diagram.we can plot multiple scatter in a single graph&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6])
y = np.array([99,86,87,88,111,86,103,87,94,78,77,85,86])
plt.scatter(x, y)
plt.scatter(x, y, color = 'hotpink')

#day two, the age and speed of 15 cars:
x = np.array([2,2,8,1,15,8,12,9,7,3,11,4,7,14,12])
y = np.array([100,105,84,105,90,99,90,95,94,100,79,112,91,80,85])
plt.scatter(x, y)
plt.scatter(x, y, color = '#88c999')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*sctter diagram attributes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6])
y = np.array([99,86,87,88,111,86,103,87,94,78,77,85,86])
colors = np.array([0, 10, 20, 30, 40, 45, 50, 55, 60, 70, 80, 90, 100])
sizes = np.array([20,50,100,200,500,1000,60,90,10,300,600,800,75])

plt.scatter(x, y, c=colors, s=sizes, alpha=0.5, cmap='nipy_spectral')

plt.colorbar()

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*Bar diagram&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = np.array(["A", "B", "C", "D"])
y = np.array([3, 8, 1, 10])

plt.bar(x,y)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*#to draw horiozontal bar&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = np.array(["A", "B", "C", "D"])
y = np.array([3, 8, 1, 10])

plt.barh(x, y)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*plt.bar() attribues&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = np.array(["A", "B", "C", "D"])
y = np.array([3, 8, 1, 10])
colors=np.array(["red","black","hotpink","yellow"])#we can add single color also customise color for every bar

plt.bar(x, y, color = colors)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  width = 0.1  bar takes width size like color we can make all bars same size or customise size like color
&lt;/h1&gt;

&lt;p&gt;*A histogram:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = np.random.normal(170, 10, 250)

plt.hist(x,color="hotpink")
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*pie chart and it's attributes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;y = np.array([15, 10, 25, 50])

plt.pie(y)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  The label parameter must be an array with one label for each wedge
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;y = np.array([35, 25, 25, 15])
mylabels = ["Apples", "Bananas", "Cherries", "Dates"]

plt.pie(y, labels = mylabels)
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Pull the "Apples" wedge 0.2 from the center of the pie:
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;y = np.array([35, 25, 25, 15])
mylabels = ["Apples", "Bananas", "Cherries", "Dates"]
myexplode = [0.2, 0, 0, 0]

plt.pie(y, labels = mylabels, explode = myexplode)
plt.show()
# Add a shadow to the pie chart by setting the shadows parameter to True:
plt.pie(y, labels = mylabels, explode = myexplode, shadow = True)
plt.show()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Specify a new color for each wedge:
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;y = np.array([35, 25, 25, 15])
mylabels = ["Apples", "Bananas", "Cherries", "Dates"]
mycolors = ["black", "hotpink", "b", "#4CAF50"]

plt.pie(y, labels = mylabels, colors = mycolors)
plt.show() 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  To add a list of explanation for each wedge, use the legend() function:
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;y = np.array([35, 25, 25, 15])
mylabels = ["Apples", "Bananas", "Cherries", "Dates"]

plt.pie(y, labels = mylabels)
plt.legend()
# To add a header to the legend, add the title parameter to the legend function. 
plt.legend(title = "Four Fruits:")
plt.show() 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>ai</category>
      <category>mlh</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Pandas-Data Manipulation and Analysis</title>
      <dc:creator>muradalhasan</dc:creator>
      <pubDate>Sat, 21 Jan 2023 18:51:40 +0000</pubDate>
      <link>https://dev.to/muradalhasan/pandas-data-manipulation-and-analysis-4bkl</link>
      <guid>https://dev.to/muradalhasan/pandas-data-manipulation-and-analysis-4bkl</guid>
      <description>&lt;p&gt;** Introduction to Pandas**&lt;/p&gt;

&lt;p&gt;Pandas is basically a Python library that is used for analyzing, cleaning, exploring, and manipulating data. Pandas allow us to analyze big data and make conclusions based on statistical theories. Pandas can clean messy data sets, and make them readable and relevant. Relevant data is very important in data science.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation and importing Pandas.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First of all, open your jupyter notebook, then go to your command panel and write “pip install Pandas”. Here we go, you are done with the installation of the Pandas library. Now, to use the Pandas library you need to import Pandas in your notebook, to do so write “import Pandas as PD”. You are ready to use Pandas Library.&lt;br&gt;
Finally, check if the installation was successful. &lt;/p&gt;

&lt;p&gt;import pandas as pd&lt;br&gt;
print(pd.&lt;strong&gt;version&lt;/strong&gt;)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting Started with Pandas&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Series
&lt;/h2&gt;

&lt;p&gt;A series can actually hold pretty much almost all types of data&lt;br&gt;
objects with python as its data point. Series also can take lots of parameters (data, index, dtype, name, copy, fastpath). To create a pandas series we just need a list initially it will generate  random index we can also manipulate index by sending a list of index with the index parameter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz3ug2huxue9ignsfnsnj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz3ug2huxue9ignsfnsnj.png" alt="Image description" width="662" height="744"&gt;&lt;/a&gt;&lt;br&gt;
Just look at the picture above. we have used an integer list and series automatically generated index but in the 2nd and 3rd series we have customized the index as we wanted that's the beauty of Pandas.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feikvusia5xmd31w0icki.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feikvusia5xmd31w0icki.png" alt="Image description" width="622" height="210"&gt;&lt;/a&gt;&lt;br&gt;
We can also use a dictionary and Pandas series will use its key as index .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmkoyya4x73i8wf6yve3f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmkoyya4x73i8wf6yve3f.png" alt="Image description" width="800" height="530"&gt;&lt;/a&gt;&lt;br&gt;
Use the index option to specify only the words you wish to be included in the Series, leaving out the rest of the words in the dictionary. Two series can added.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Frames&lt;/strong&gt;&lt;br&gt;
Data Frame is known as the main tool of Pandas. It takes multiple parameters like data, column, rows, dtype, copy. To start with Data Frames we have some necessary setting in our Jypyter. As we don't have any specific data so, we will use random data to learn Data Frames.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import numpy as np
import pandas as pd
from numpy.random import randn
np.random.seed(101)
df=pd.DataFrame(randn(5,4),["A","B","C","D","E"],["X","Y","Z","P"])
df
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
       X           Y           Z          P
A   2.706850    0.628133    0.907969    0.503826
B   0.651118    -0.319318   -0.848077   0.605965
C   -2.018168   0.740122    0.528813    -0.589001
D   0.188695    -0.758872   -0.933237   0.955057
E   0.190794    1.978757    2.605967    0.683509
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Data Frames is just bunches of series. we can access those series by following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; **df["X"]
output
    X          Y
A   2.706850    0.628133
B   0.651118    -0.319318
C   -2.018168   0.740122
D   0.188695    -0.758872
E   0.190794    1.978757
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;more than one series is a data frames&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**df[["X","Y"]]
        X         Y
A   2.706850    0.628133
B   0.651118    -0.319318
C   -2.018168   0.740122
D   0.188695    -0.758872
E   0.190794    1.978757
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we can also add or drop any column.&lt;br&gt;
To add any column.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df["updated"]=df["X"]+df["Y"]
df["updated"]

A    3.334983
B    0.331800
C   -1.278046
D   -0.570177
E    2.169552
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it will add the number column x and y and create a column which will be added as updated.&lt;br&gt;
To drop any column.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df.drop("updated",axis=1,inplace=True)
df
         X          Y          Z        p
A   2.706850    0.628133    0.907969    0.503826    
B   0.651118    -0.319318   -0.848077   0.605965    
C   -2.018168   0.740122    0.528813        -1.278046
D   0.188695    -0.758872   -0.933237   0.955057    
E   0.190794    1.978757    2.605967    0.683509    
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;as we have set inplace as true so the updated column will drop permanently.&lt;br&gt;
we can also add or drop any rows or columns by using this command.&lt;br&gt;
&lt;code&gt;df.drop("D")&lt;/code&gt;&lt;br&gt;
we just have to put the row or column name and it will be droped automatically.&lt;br&gt;
we can check dimension of a data frames by&lt;br&gt;
&lt;code&gt;df.shape&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Conditional selection in Data Frames
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df&amp;gt;0
output
      X     Y       Z        P      updated
A   True    True    True    True    True
B   True    False   False   True    True
C   False   True    True    False   False
D   True    False   False   True    False
E   True    True    True    True    True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;we can also specify only false value&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;booldf=df&amp;gt;0
df[booldf]
output
       X            Y           Z            P  
A   2.706850    0.628133    0.907969    0.503826    
B   0.651118    NaN          NaN            0.605965
C   NaN         0.740122    0.528813    NaN
D   0.188695    NaN          NaN           0.955057 
E   0.190794    1.978757    2.60596     2.169552
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we can also use specific rows or column or both&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df["X"]&amp;gt;0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;starting  with multiple conditions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df[(df["X"]&amp;gt;0) | (df["Y"]&amp;gt;1)]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;** skipping index reset it's bit harder to explain index reset in that blog.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pipe Index Oparetor
&lt;/h2&gt;

&lt;p&gt;index level&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a="G1 G1 G1 G2 G2 G2".split()
outside=a
inside=[1,2,3,1,2,3]
higher_index=list(zip(outside,inside))
higher_index=pd.MultiIndex.from_tuples(higher_index)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now we can use that pipe index to built a multi level index&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df=pd.DataFrame(randn(6,2),higher_index,["A","B"])

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to get sub data frames from a multilevel index&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df.loc["G1"]
df.loc["G1"].loc[1]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Missing Data
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;d={"A":[1,2,np.nan],"B":[1,np.nan,np.nan],"C":[1,2,3]}
df=pd.DataFrame(d)
output
       A    B   C
0   1.0 1.0 1
1   2.0 NaN 2
2   NaN NaN 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to drop any row that hold missing data&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df.dropna()
it will drop that rows that has one or more NaN value 
df.dropna(axis=1)
it will drop that coloum that has one or more NaN value  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to fill any missing data&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df.fillna(value="FIll  VALUE")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to chnage specific value&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df["A"].fillna(value=3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;mean function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df["A"].fillna(value=df["A"].mean())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  GROUP BY
&lt;/h2&gt;

&lt;p&gt;all functions of group by&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data={"Company":["GOOG","GOOG","ghgh","fdff"],"Persoon":["Mridul","Mohosin","Sabid","Raihan"],"Sales":[10,12,34,45]}
df=pd.DataFrame(data)
df
bycomp=df.groupby("Company")
to find minimun valuee
bycomp.mean()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;total sell of a company&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bycomp.sum()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;standered division&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bycomp.std()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to see sells of a specific company&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bycomp.sum().loc["GOOG"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df.groupby("Company").sum().loc["GOOG"]
df.groupby("Company").count()
df.groupby("Company").max()
df.groupby("Company").min()
df.groupby("Company").describe()
df.groupby("Company").describe().transpose()
df.groupby("Company").describe().transpose()["GOOG"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  merging,joining,concatenating
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dic={
    'col1':[1,2,3,4,5],
    "col2":[45,5,77,88,5],
    "col3":["abc","def","ghi","jkl","mno"],
}
df=pd.DataFrame(dic)
df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  to find unique values in a specific coloum
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df["col2"].unique()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  it will return a arrays with unique values
&lt;/h1&gt;

&lt;h1&gt;
  
  
  we can aslo check the lenght of that array by len function
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;len(df["col2"].unique())

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  nunique is an alternatives of len function
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df["col2"].nunique()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;unique value count method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df["col2"].value_counts()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;filtering data using conditional statement&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df[df["col1"]&amp;gt;2]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;pandas can use  customizer function&lt;/p&gt;

&lt;h3&gt;
  
  
  Thank you
&lt;/h3&gt;

</description>
    </item>
    <item>
      <title>Introduction To NumPy</title>
      <dc:creator>muradalhasan</dc:creator>
      <pubDate>Fri, 18 Nov 2022 17:56:57 +0000</pubDate>
      <link>https://dev.to/muradalhasan/introduction-to-numpy-32nh</link>
      <guid>https://dev.to/muradalhasan/introduction-to-numpy-32nh</guid>
      <description>&lt;p&gt;Introduction To Numpy&lt;/p&gt;

&lt;p&gt;NumPy, which stands for Numerical Python, is a library consisting of multidimensional array objects and a collection of functions for processing those arrays.Basically NumPy arrays  are  50x faster then python lists that’s why we may have to use NumPy to handle big data .The array object in NumPy is called “ndarray”, it provides a lot of supporting functions that make working with  “ndarray” very easy.Arrays are very frequently used in data science, where speed and resources are very important.&lt;/p&gt;

&lt;p&gt;INSTALLATION AND IMPORTING NumPy&lt;/p&gt;

&lt;p&gt;First of all open your Jupyter notebook,then go to your command panel write “pip install numpy”.Here we go,you are done with installation of NumPy library .Now,to use NumPy library you need to import NumPy in your notebook,to do so write “import numpy as np”.You are ready to use NumPy Library.&lt;/p&gt;

&lt;p&gt;GETTING STARTED WITH NumPy&lt;br&gt;
1.Converting a list into a array&lt;br&gt;
            Let say,&lt;br&gt;
            Import numpy as np&lt;br&gt;
            my_list=[1,2,3,4,5]&lt;br&gt;&lt;br&gt;
            #one dimension array&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        arr=np.array(my_list)
        print(arr)  #it will print a array
        print(type(arr)) ##type array
        ######Two Dimensional array
        my_list=[[1,2,3][4,5,6][6,7,8]]
        arr=np.array(my_list)
        ##indexing of arrays are  similar to list indexing  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;2.Creating  automatic one dimensional array&lt;br&gt;
arr=np.arange(a,b,c) #a=star(inclusive),b=end(exclusive),c=step&lt;br&gt;
          ##it will generate array like for loop&lt;br&gt;
**Split of an array&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import numpy as np

arr = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18]])

newarr = np.array_split(arr, 3, axis=1)

print(newarr)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;**output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[array([[ 1],
       [ 4],
       [ 7],
       [10],
       [13],
       [16]]), array([[ 2],
       [ 5],
       [ 8],
       [11],
       [14],
       [17]]), array([[ 3],
       [ 6],
       [ 9],
       [12],
       [15],
       [18]])]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;**to find a specific eliment index&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import numpy as np

arr = np.array([1, 2, 3, 4, 5, 4, 4])

x = np.where(arr == 4)

print(x)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(array([3, 5, 6], dtype=int64),)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*to sort an array&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arr = np.array([3, 2, 0, 1])

print(np.sort(arr))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[0 1 2 3]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*to filter an array with some specific condition&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arr = np.array([41, 42, 43, 44])
filter_arr = []
for element in arr:
  if element &amp;gt; 42:
    filter_arr.append(True)
  else:
    filter_arr.append(False)
newarr = arr[filter_arr]
print(filter_arr)
print(newarr)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[False, False, True, True]
[43 44]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.Generating  matrix with Natural Numbers&lt;br&gt;
         arr=np.zeros(a) #a → length &lt;br&gt;
          output=array([0., 0., 0.]) #a=3&lt;br&gt;
         arr=np.zeros((a,b)) #a→row,by→column &lt;br&gt;
         output=array([[0., 0., 0.],  #here a=2 and b=3&lt;br&gt;
                                                [0., 0., 0.]])&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   ####we can also generate with other numbers
   arr=np.ones((2,3))
   arr=np.twos((5,5))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;4.Generating fractional array (linspace)&lt;br&gt;
arr=np.linspace(x,y,z) &lt;/p&gt;

&lt;h1&gt;
  
  
  x →starting number(inclusive),y →ending number(inclusive),z →total number of numbers
&lt;/h1&gt;

&lt;p&gt;5.Generating Identity metrics &lt;br&gt;
arr=np.eye(x) ##x →Number of rows and column &lt;br&gt;
6.the random number numpy genarate is basically psudo random number cause there is and algorithm that generate random number random can generate three types of random number interger,float and negative.&lt;br&gt;
arrays of random numbers&lt;br&gt;
arr=np.random.rand(a) #a —&amp;gt;single line length &lt;br&gt;
arr=np.random.rand(a,b) #a by b matrix&lt;br&gt;
np.random.randn(2,4) #row column dimension float&lt;br&gt;
np.random.randint(1,100) #it will generate a random number from 0 to 99&lt;br&gt;
np.random.randint(1,100,10) # it will generate 10 random int number from 1 to 100 and 100 exclusive&lt;br&gt;
7.#reshape method&lt;br&gt;
arr= np.arange(25)&lt;br&gt;
arr.reshape(5,5)&lt;br&gt;
8.#to return max value of a array&lt;br&gt;
arr.max()&lt;br&gt;
9.# to return min&lt;br&gt;
arr.min()&lt;br&gt;
10.# to see max and min value location # arg&lt;br&gt;
arr.argmax()&lt;br&gt;
arr.argmin()&lt;br&gt;
11.##numpy indexing and selection&lt;br&gt;
arr=np.arange(1,10)&lt;/p&gt;

&lt;h1&gt;
  
  
  arr
&lt;/h1&gt;

&lt;p&gt;arr[8]&lt;br&gt;
arr[2:5]&lt;br&gt;
12.# to change the value by using index&lt;br&gt;
arr[0:3]=100&lt;br&gt;
arr&lt;br&gt;
13.##to access any element from the arr_2D&lt;br&gt;
arr_2D=np.array([[1,2,3],[4,5,6],[7,8,9]])&lt;br&gt;
arr_2D[0][1] #matrix concept&lt;br&gt;
14.##conditional selection&lt;br&gt;
arr=np.arange(1,15)&lt;br&gt;
arr&lt;br&gt;
arr&amp;gt;5&lt;br&gt;
bool_arr=arr&amp;gt;5&lt;br&gt;
arr[bool_arr]&lt;br&gt;
15.###numpy operations&lt;br&gt;
import numpy as np&lt;br&gt;
arr=np.arange(10)&lt;br&gt;
Arr+arr&lt;br&gt;
Arr+100&lt;/p&gt;

&lt;p&gt;16.#numpy subtract&lt;br&gt;
arr-arr&lt;br&gt;
17.##numpy multiplication&lt;br&gt;
arr*arr&lt;br&gt;
19.#numpy division&lt;br&gt;
arr/arr&lt;/p&gt;

&lt;h2&gt;
  
  
  0 by 0 infinity
&lt;/h2&gt;

&lt;p&gt;20.##numpy exponential&lt;br&gt;
arr**2&lt;br&gt;
np.sin(arr)&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
