0% found this document useful (0 votes)
10 views5 pages

ADS 3.ipynb - Colaboratory

The document explores various data visualization techniques using Python libraries like NumPy, Pandas, Matplotlib and Seaborn. It contains code to generate box plots, histograms, heat maps, line plots, bar plots and scatter plots from sample and real-world datasets.

Uploaded by

Mahesh Badgujar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

ADS 3.ipynb - Colaboratory

The document explores various data visualization techniques using Python libraries like NumPy, Pandas, Matplotlib and Seaborn. It contains code to generate box plots, histograms, heat maps, line plots, bar plots and scatter plots from sample and real-world datasets.

Uploaded by

Mahesh Badgujar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

2/21/24, 2:36 PM ADS 3.

ipynb - Colaboratory

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

house=pd.read_csv('global-fortune-500-data.csv')

#BoxPlot
plt.figure(figsize=(7,8))
sns.boxplot(data=house,x="Industry",y="Rank")
plt.grid()
plt.title("Box Plot")
plt.show()

import numpy as np
x = np.random.randint(low = 10, high=100, size = 100)
print(x)

[26 52 72 30 77 80 89 85 15 44 16 72 62 13 97 38 34 97 42 73 70 32 78 94
36 20 23 80 23 88 37 10 31 34 49 56 97 94 17 69 18 16 69 26 28 77 12 59
91 56 75 60 69 87 72 74 76 63 33 43 61 14 31 27 25 90 79 83 92 33 39 71
72 26 85 48 49 90 33 39 87 35 94 85 22 57 61 89 34 97 44 61 84 88 20 12
46 10 45 10]

plt.hist(x,width = 2)
plt.grid()
plt.show()

https://colab.research.google.com/drive/1nWw4Ehcikyhh9Md69zN0YWZpckUFAU-Y#scrollTo=Qwis_1NU4_nz&printMode=true 1/5
2/21/24, 2:36 PM ADS 3.ipynb - Colaboratory

#Heat Maps
import seaborn as sns
data = np.random.randint(low=1,high=100,size=(10,10))
print(data)

[[58 2 2 90 90 21 58 41 60 80]
[55 21 71 62 19 82 9 44 62 38]
[44 35 49 56 13 53 4 81 53 15]
[11 49 89 12 43 55 24 55 69 79]
[86 81 78 8 60 5 18 33 4 17]
[16 66 36 45 59 69 82 33 18 68]
[14 14 89 32 21 10 62 99 37 99]
[35 59 7 16 59 42 38 81 56 93]
[54 45 67 22 96 58 29 48 67 83]
[34 91 62 29 72 2 59 96 77 41]]

hm = sns.heatmap(data=data)
plt.show()

import matplotlib.pyplot as mp
import pandas as pd
import seaborn as sb

data = pd.read_csv("global-fortune-500-data.csv")

dataplot = sb.heatmap(data.corr())

mp.show()

https://colab.research.google.com/drive/1nWw4Ehcikyhh9Md69zN0YWZpckUFAU-Y#scrollTo=Qwis_1NU4_nz&printMode=true 2/5
2/21/24, 2:36 PM ADS 3.ipynb - Colaboratory

<ipython-input-23-4e152917595d>:7: FutureWarning: The default value of numeric_only i


dataplot = sb.heatmap(data.corr())

x = np.array([100, 500, 800, 1000, 2000, 30000])


y = np.array([1000, 5000, 10000, 15000, 20000, 25000])
plt.title("Employee Data")
plt.xlabel("Average Revenue")
plt.ylabel("Employee")
plt.plot(x,y)
plt.grid()
plt.show()

import seaborn as sn
import matplotlib.pyplot as plt
import pandas as pd

data = pd.read_csv("global-fortune-500-data.csv")

data = data.iloc[2:10, :]

sn.lineplot(x="Industry", y ="Rank", data=data)


plt.xticks(rotation=45)

plt.title("Line Plot")
plt.show()

https://colab.research.google.com/drive/1nWw4Ehcikyhh9Md69zN0YWZpckUFAU-Y#scrollTo=Qwis_1NU4_nz&printMode=true 3/5
2/21/24, 2:36 PM ADS 3.ipynb - Colaboratory

x=[10, 20, 30, 40, 50]


y=[5, 10, 7, 6, 8]
plt.bar(x,y)
plt.show()

import seaborn as sns


import matplotlib.pyplot as plt
import pandas as pd

# Read the CSV file


house = pd.read_csv("global-fortune-500-data.csv")

# Create the bar plot


sns.barplot(x="Industry", y="Rank", data=house)

# Rotate x-axis labels for better visibility


plt.xticks(rotation=90)

# Show the plot


plt.show()

https://colab.research.google.com/drive/1nWw4Ehcikyhh9Md69zN0YWZpckUFAU-Y#scrollTo=Qwis_1NU4_nz&printMode=true 4/5
2/21/24, 2:36 PM ADS 3.ipynb - Colaboratory

import seaborn

seaborn.set(style='whitegrid')
house=pd.read_csv('global-fortune-500-data.csv')

seaborn.scatterplot(x="Country", y="Rank", data=house)


plt.xticks(rotation=90)
plt.show()

https://colab.research.google.com/drive/1nWw4Ehcikyhh9Md69zN0YWZpckUFAU-Y#scrollTo=Qwis_1NU4_nz&printMode=true 5/5

You might also like