Code 2 line graph
Code 4 box plot graph
Dataset 1
id product unit
1 apple 11
2 peas 22
3 grapes 33
4 bananas 44
Dataset 2
| Company name | Market capital | PE ratio | Earnings per share | Dividend yield | Sector P/E | Price to Book | Debt to equity | Return on equity | Price to sales | |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Adani wilmar | 672322 | 97.79 | 5.29 | 0.00 | 55.42 | 8.58 | 0.40 | 8.79 | 1.15 |
| 1 | Happiest Minds | 12432 | 55.15 | 15.35 | 0.43 | 26.60 | 16.65 | 0.53 | 29.06 | 9.20 |
| 2 | Route mobile | 7525 | 27.76 | 43.51 | 0.42 | 26.60 | 4.53 | 0.01 | 14.04 | 2.36 |
| 3 | Avenue supermart | 230834 | 98.44 | 36.20 | 0.00 | 89.37 | 15.38 | 0.05 | 15.38 | 5.63 |
| 4 | Paras defence tech | 2090 | 62.20 | 8.59 | 0.00 | 4.25 | 5.94 | 0.09 | 8.52 | 10.24 |
| 5 | Laxmi organic | 7236 | 45.87 | 5.95 | 0.26 | 27.11 | 5.34 | 0.19 | 15.69 | 2.46 |
| 6 | KPIT | 19131 | 60.21 | 11.59 | 0.44 | 26.60 | 13.70 | 0.13 | 22.83 | 7.07 |
Python Code for Charts
a simple graph
- from matplotlib import pyplot as plt
- #ploting our canvas
- plt.plot([1,2,3],[4,5,1])
- #display the graph
- plt.show()
Line Graph
- from matplotlib import pyplot as plt
- x = [1,2,3]
- y = [10,11,12]
- plt.plot(x,y)
- plt.title("Line graph")
- plt.ylabel('Y axis')
- plt.xlabel('X axis')
- plt.show()
Bar graph
- from matplotlib import pyplot as plt
- Names = ['Arun','James','Ricky','Patrick']
- Marks = [51,87,45,67]
- plt.bar(Names,Marks,color = 'blue')
- plt.title('Result')
- plt.xlabel('Names')
- plt.ylabel('Marks')
- plt.show()
Pie chart
- from matplotlib import pyplot as plt
- # Pie chart, where the slices will be ordered and plotted counter-clockwise:
- Aus_Players = 'Smith', 'Finch', 'Warner', 'Lumberchane'
- Runs = [42, 32, 18, 24]
- explode = (0.1, 0, 0, 0) # it "explode" the 1st slice
- fig1, ax1 = plt.subplots()
- ax1.pie(Runs, explode=explode, labels=Aus_Players, autopct='%1.1f%%',
- shadow=True, startangle=90)
- ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
- plt.show()
Histogram
- from matplotlib import pyplot as plt
- from matplotlib import pyplot as plt
- percentage = [97,54,45,10, 20, 10, 30,97,50,71,40,49,40,74,95,80,65,82,70,65,55,70,75,60,52,44,43,42,45]
- number_of_student = [0,10,20,30,40,50,60,70,80,90,100]
- plt.hist(percentage, number_of_student, histtype='bar', rwidth=0.8)
- plt.xlabel('percentage')
- plt.ylabel('Number of people')
- plt.title('Histogram')
- plt.show()
Scatter Plot
- from matplotlib import pyplot as plt
- from matplotlib import style
- style.use('ggplot')
- x = [4,8,12]
- y = [19,11,7]
- x2 = [7,10,12]
- y2 = [8,18,24]
- plt.scatter(x, y)
- plt.scatter(x2, y2, color='g')
- plt.title('Epic Info')
- plt.ylabel('Y axis')
- plt.xlabel('X axis')
- plt.show()

The way you explain a complex topic in an easy-to-understand way is really impressive.
ReplyDeleteHire React Developer from Chennai