Created
December 29, 2013 15:12
-
-
Save ryanswanstrom/8171330 to your computer and use it in GitHub Desktop.
generates a data file with defect data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "defect_data.ipynb" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Create a Defects Data File for Super Corp\n", | |
"\n", | |
"The columns in the data file are:\n", | |
" \n", | |
"1. AppID\n", | |
"1. Application Name (optional)\n", | |
"1. Release Date\n", | |
"1. Development Hours\n", | |
"1. Testing Hours\n", | |
"1. SIT Defects\n", | |
"1. UAT Defects\n", | |
"1. Production Defects\n", | |
"1. Reporting Date/Time\n", | |
"\n", | |
"There will be data on 5 different Applications released every month for 14 months." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"import pandas as pd\n", | |
"import time\n", | |
"from datetime import date\n", | |
"from datetime import timedelta\n", | |
"import csv\n", | |
"\n", | |
"appIDs = [\"app1\", \"app2\", \"app3\", \"app4\", \"app5\"]\n", | |
"appNames = [\"Application 1\", \"Application 2\", \"Application 3\", \"Application 4\", \"Application 5\"]\n", | |
"\n", | |
"random.seed(56782)\n", | |
"data = []\n", | |
"for i in range(0,14):\n", | |
" for j in range(0,len(appIDs)):\n", | |
" hours = random.randint(50*(j+1), 150*(j+1)) \n", | |
" d = datetime.date(2013, 12, 29) - timedelta(weeks=( (14-i)*4.4) )\n", | |
" data.append( [appIDs[j], appNames[j], d - timedelta(days=22), hours, 0, (hours/3)+ random.randint(-25,25), (hours/12)+ random.randint(-10,10), (hours/20)+ random.randint(-5,5), d] )\n", | |
" #print str(i) + appIDs[j] + ' : ' + appNames[j]\n", | |
"\n", | |
"\n", | |
"df = pd.DataFrame(data, columns=['AppID', 'AppName', 'ReleaseDate', 'DevHours', 'TestHours','SITDefects','UATDefects','ProdDefects','ReportDate'])\n", | |
"#df.columns\n", | |
"df.to_csv(\"supercorp_defect_1.csv\", index=False, quoting=csv.QUOTE_NONNUMERIC)\n", | |
" " | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 17 | |
}, | |
{ | |
"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