Skip to content

Commit a0aa119

Browse files
Created using Colaboratory
1 parent 82829d0 commit a0aa119

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 0,
4+
"metadata": {
5+
"colab": {
6+
"provenance": [],
7+
"authorship_tag": "ABX9TyOkPw5OKBHEeeVu/lIDPZuA",
8+
"include_colab_link": true
9+
},
10+
"kernelspec": {
11+
"name": "python3",
12+
"display_name": "Python 3"
13+
},
14+
"language_info": {
15+
"name": "python"
16+
}
17+
},
18+
"cells": [
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {
22+
"id": "view-in-github",
23+
"colab_type": "text"
24+
},
25+
"source": [
26+
"<a href=\"https://colab.research.google.com/github/DeepthiTabithaBennet/Python_AppliedStatistics/blob/main/Stem%26LeafDisplay_CrossTabulation.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
27+
]
28+
},
29+
{
30+
"cell_type": "markdown",
31+
"metadata": {
32+
"id": "TuCzqvKPvrPE"
33+
},
34+
"source": [
35+
"**Stem and Leaf Display**"
36+
]
37+
},
38+
{
39+
"cell_type": "code",
40+
"metadata": {
41+
"id": "hcJrM0A5uwjT"
42+
},
43+
"source": [
44+
"# Written by Deepthi Tabitha Bennet\n",
45+
"\n",
46+
"!pip install stemgraphic"
47+
],
48+
"execution_count": null,
49+
"outputs": []
50+
},
51+
{
52+
"cell_type": "code",
53+
"metadata": {
54+
"id": "IoRuQCM7ovW-"
55+
},
56+
"source": [
57+
"import stemgraphic\n",
58+
" \n",
59+
"data = [23, 56, 76, 34, 87, 56, 98, 12, 46, 98, 9, 34, 56, 76, 35, 12, 84, 36, 45, 23, 12, 87, 3, 78, 94, 47]\n",
60+
" \n",
61+
"stemgraphic.stem_graphic(data, scale = 10)"
62+
],
63+
"execution_count": null,
64+
"outputs": []
65+
},
66+
{
67+
"cell_type": "markdown",
68+
"metadata": {
69+
"id": "-fgwBjOQwIRq"
70+
},
71+
"source": [
72+
"**Cross Tabulation**"
73+
]
74+
},
75+
{
76+
"cell_type": "code",
77+
"metadata": {
78+
"id": "LbkOj8xPx72N"
79+
},
80+
"source": [
81+
"# importing packages\n",
82+
"import pandas\n",
83+
"import numpy\n",
84+
"\n",
85+
"# creating some data\n",
86+
"a = numpy.array([\"Bad\", \"Good\", \"Very Good\", \"Excellent\", \"Excellent\", \"Very Good\", \"Good\", \"Bad\",\n",
87+
"\t\t\t\t\"Bad\", \"Good\", \"Very Good\", \"Excellent\", \"Excellent\", \"Very Good\", \"Good\", \"Bad\",\n",
88+
"\t\t\t\t\"Bad\", \"Good\", \"Very Good\", \"Excellent\", \"Excellent\", \"Very Good\", \"Good\", \"Bad\",\n",
89+
"\t\t\t\t\"Bad\", \"Good\", \"Very Good\", \"Excellent\", \"Excellent\", \"Very Good\", \"Good\", \"Bad\"],\n",
90+
"\t\t\t\tdtype=object)\n",
91+
"\n",
92+
"b = numpy.array([\"0 - 100\", \"100 - 250\", \"250 - 500\", \"500 - 1000\", \"1000 - 2500\", \"2500 - 5000\", \"5000 - 7500\", \"7500 - 10000\", \"10000 - 15000\", \"15000 - 20000\", \"20000 - 30000\", \"Above 30000\", \n",
93+
"\t\t\t\t\"0 - 100\", \"100 - 250\", \"250 - 500\", \"500 - 1000\", \"1000 - 2500\", \"2500 - 5000\", \"5000 - 7500\", \"7500 - 10000\", \"10000 - 15000\", \"15000 - 20000\", \"20000 - 30000\", \"Above 30000\",\n",
94+
"\t\t\t\t\"0 - 100\", \"100 - 250\", \"250 - 500\", \"500 - 1000\", \"1000 - 2500\", \"2500 - 5000\", \"5000 - 7500\", \"7500 - 10000\"],\n",
95+
"\t\t\t\tdtype=object)\n",
96+
"\n",
97+
"# form the cross tab\n",
98+
"pandas.crosstab(b, a, rownames=['Cost (in Rs.)'], colnames=['Rating'])\n"
99+
],
100+
"execution_count": null,
101+
"outputs": []
102+
}
103+
]
104+
}

0 commit comments

Comments
 (0)