Skip to content

Commit d987886

Browse files
committed
More snippits
1 parent 74bb8d1 commit d987886

13 files changed

+5140
-0
lines changed

Untitled0.ipynb

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"metadata": {
3+
"name": "",
4+
"signature": "sha256:cde834b4630abeb021db1dc03e98b143f55b68177957a95a558f61eb79bf28a7"
5+
},
6+
"nbformat": 3,
7+
"nbformat_minor": 0,
8+
"worksheets": [
9+
{
10+
"cells": [
11+
{
12+
"cell_type": "code",
13+
"collapsed": false,
14+
"input": [
15+
"import pandas as pd\n",
16+
"\n",
17+
"raw_data = {'name': ['Miller', 'Jacobson', 'Ali', 'Milner', 'Cooze', 'Jacon', 'Ryaner', 'Sone', 'Sloan', 'Piger', 'Riani', 'Ali'], \n",
18+
" 'score': [25, 94, 57, 62, 70, 25, 94, 57, 62, 70, 62, 70]}\n",
19+
"df = pd.DataFrame(raw_data, columns = ['name', 'score'])\n",
20+
"\n",
21+
"bins = [0, 25, 50, 75, 100]\n",
22+
"group_names = ['Low', 'Okay', 'Good', 'Great']\n",
23+
"\n",
24+
"cat_obj = pd.cut(df['score'], bins, labels=group_names)\n",
25+
"df['cat'] = pd.cut(df['score'], bins, labels=group_names)"
26+
],
27+
"language": "python",
28+
"metadata": {},
29+
"outputs": [],
30+
"prompt_number": 4
31+
},
32+
{
33+
"cell_type": "code",
34+
"collapsed": false,
35+
"input": [
36+
"type(cat_obj)"
37+
],
38+
"language": "python",
39+
"metadata": {},
40+
"outputs": [
41+
{
42+
"metadata": {},
43+
"output_type": "pyout",
44+
"prompt_number": 7,
45+
"text": [
46+
"pandas.core.categorical.Categorical"
47+
]
48+
}
49+
],
50+
"prompt_number": 7
51+
},
52+
{
53+
"cell_type": "code",
54+
"collapsed": false,
55+
"input": [
56+
"type(df['cat'])"
57+
],
58+
"language": "python",
59+
"metadata": {},
60+
"outputs": [
61+
{
62+
"metadata": {},
63+
"output_type": "pyout",
64+
"prompt_number": 8,
65+
"text": [
66+
"pandas.core.series.Series"
67+
]
68+
}
69+
],
70+
"prompt_number": 8
71+
},
72+
{
73+
"cell_type": "code",
74+
"collapsed": false,
75+
"input": [],
76+
"language": "python",
77+
"metadata": {},
78+
"outputs": []
79+
}
80+
],
81+
"metadata": {}
82+
}
83+
]
84+
}

0 commit comments

Comments
 (0)