Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kinverarity1/c59266f98d519e0d9824 to your computer and use it in GitHub Desktop.
Save kinverarity1/c59266f98d519e0d9824 to your computer and use it in GitHub Desktop.
Break up unit numbers for searching WaterConnect
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:2e0be7c8d57d709bf62ca27a312a928037f73b8e807e0fa7e896c82fb767a868"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"import pandas"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 21
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"unit_nums = pandas.read_excel(\"Copy for Kent.03.08.2015 - typos fixed.xlsx\", \"Sheet1\")[\"DWLBC Unit No\"]"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 23
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"units_dashed = sorted([str(u)[:4] + \"-\" + str(u)[4:] for u in unitnums.splitlines()])"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 24
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"len(units_dashed)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 25,
"text": [
"165"
]
}
],
"prompt_number": 25
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print \",\".join(units_dashed)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"5643-00048,5643-00050,5732-00219,5732-00220,5732-00224,5732-00242,5732-00485,5732-00578,5732-00579,5732-00580,5732-00581,5732-00582,5732-00583,5732-00584,5732-00585,5732-00586,5732-00587,5732-00588,5732-00589,5732-00592,5830-00257,5830-00258,5928-00307,5928-00437,5928-00438,5928-00439,5928-00447,5930-00967,5930-01318,5942-00008,5942-00049,6028-00354,6028-00381,6028-00382,6028-00383,6028-00385,6028-00386,6028-00387,6028-00473,6028-00474,6028-00475,6028-00476,6028-00477,6028-00650,6028-00696,6028-00697,6028-00698,6028-00699,6028-00700,6028-00701,6028-00702,6028-00703,6028-00915,6028-00924,6028-00947,6028-01514,6028-01528,6028-01655,6028-01656,6028-01694,6028-02093,6028-02094,6028-02156,6028-02158,6028-02159,6028-02160,6028-02163,6028-02164,6028-02166,6028-02168,6028-02169,6028-02286,6328-00139,6328-00144,6328-00400,6328-00429,6328-00431,6432-01002,6433-00143,6433-00147,6433-00698,6433-00699,6433-00700,6532-00169,6532-01005,6532-01383,6532-01499,6532-01642,6532-01666,6532-01668,6532-01677,6533-00138,6533-00177,6533-00179,6533-00863,6533-00910,6534-00141,6534-00146,6534-00340,6534-00341,6535-00146,6535-00170,6538-00008,6538-00209,6627-07647,6627-07648,6632-00981,6632-01140,6635-00141,6635-00274,6823-00949,6823-01349,6823-01529,6824-00470,6824-01602,6824-01876,6824-02300,6824-02301,6922-02140,6922-02174,6922-02578,6922-04589,6922-04705,6922-04725,6922-04726,6923-03275,6923-04516,6924-02244,6924-03983,6924-04115,6927-00591,6927-00991,7021-01347,7021-03553,7022-02927,7022-05795,7022-06661,7022-07537,7022-08115,7022-09378,7022-09985,7022-10850,7023-06884,7023-07201,7024-01598,7024-01630,7024-04110,7024-04128,7024-04412,7024-04509,7024-06113,7025-00868,7025-02615,7025-03222,7025-03875,7025-03876,7025-03877,7027-00221,7027-00488,7027-00505,7027-00592,7027-00602,7027-00606,7027-00916,7027-00917\n"
]
}
],
"prompt_number": 26
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"step = 45\n",
"for i in range(0, len(units_dashed), step):\n",
" print \",\".join(units_dashed[i: i + step])\n",
" print \"\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"5643-00048,5643-00050,5732-00219,5732-00220,5732-00224,5732-00242,5732-00485,5732-00578,5732-00579,5732-00580,5732-00581,5732-00582,5732-00583,5732-00584,5732-00585,5732-00586,5732-00587,5732-00588,5732-00589,5732-00592,5830-00257,5830-00258,5928-00307,5928-00437,5928-00438,5928-00439,5928-00447,5930-00967,5930-01318,5942-00008,5942-00049,6028-00354,6028-00381,6028-00382,6028-00383,6028-00385,6028-00386,6028-00387,6028-00473,6028-00474,6028-00475,6028-00476,6028-00477,6028-00650,6028-00696\n",
"\n",
"6028-00697,6028-00698,6028-00699,6028-00700,6028-00701,6028-00702,6028-00703,6028-00915,6028-00924,6028-00947,6028-01514,6028-01528,6028-01655,6028-01656,6028-01694,6028-02093,6028-02094,6028-02156,6028-02158,6028-02159,6028-02160,6028-02163,6028-02164,6028-02166,6028-02168,6028-02169,6028-02286,6328-00139,6328-00144,6328-00400,6328-00429,6328-00431,6432-01002,6433-00143,6433-00147,6433-00698,6433-00699,6433-00700,6532-00169,6532-01005,6532-01383,6532-01499,6532-01642,6532-01666,6532-01668\n",
"\n",
"6532-01677,6533-00138,6533-00177,6533-00179,6533-00863,6533-00910,6534-00141,6534-00146,6534-00340,6534-00341,6535-00146,6535-00170,6538-00008,6538-00209,6627-07647,6627-07648,6632-00981,6632-01140,6635-00141,6635-00274,6823-00949,6823-01349,6823-01529,6824-00470,6824-01602,6824-01876,6824-02300,6824-02301,6922-02140,6922-02174,6922-02578,6922-04589,6922-04705,6922-04725,6922-04726,6923-03275,6923-04516,6924-02244,6924-03983,6924-04115,6927-00591,6927-00991,7021-01347,7021-03553,7022-02927\n",
"\n",
"7022-05795,7022-06661,7022-07537,7022-08115,7022-09378,7022-09985,7022-10850,7023-06884,7023-07201,7024-01598,7024-01630,7024-04110,7024-04128,7024-04412,7024-04509,7024-06113,7025-00868,7025-02615,7025-03222,7025-03875,7025-03876,7025-03877,7027-00221,7027-00488,7027-00505,7027-00592,7027-00602,7027-00606,7027-00916,7027-00917\n",
"\n"
]
}
],
"prompt_number": 27
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment