Crude Error Insertion

For insertion of errors, start with crude errors:

a) Take some variables for only numerical values and randomly insert characters into numbers,

b) take variables that must not have nulls, and insert spaces

c) look into some range values and insert values that are outside of these values.


In [46]:
import pandas as pd
import math
import string
import random
from random import randint

In [47]:
file = pd.read_csv("/Users/michaelbowie/Downloads/INPUTEVENTS_MV.csv")

In [48]:
file = file.iloc[::30, :]

In [60]:
file = file.reset_index(drop=True)

In [61]:
file


Out[61]:
ROW_ID SUBJECT_ID HADM_ID ICUSTAY_ID STARTTIME ENDTIME ITEMID AMOUNT AMOUNTUOM RATE ... TOTALAMOUNTUOM ISOPENBAG CONTINUEINNEXTDEPT CANCELREASON STATUSDESCRIPTION COMMENTS_EDITEDBY COMMENTS_CANCELEDBY COMMENTS_DATE ORIGINALAMOUNT ORIGINALRATE
0 119199 42367 139932 250305 2147-10-21 23:42:00 2147-10-21 23:43:00 223259 15.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 15.000000 15.000000
1 119080 42367 139932 250305 2147-10-19 16:11:00 2147-10-19 16:12:00 226453 40.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 40.000000 40.000000
2 119227 42367 139932 250305 2147-10-28 19:56:00 2147-10-28 19:57:00 225799 60.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 60.000000 60.000000
3 119110 42367 139932 250305 2147-10-14 11:15:00 2147-10-14 11:16:00 221744 49.999999 mcg NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 50.000000 50.000000
4 119244 42367 139932 250305 2147-10-18 16:30:00 2147-10-18 17:30:00 225166 20.000000 mEq NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 20.000000 0.333333
5 118991 42367 139932 250305 2147-10-04 06:00:00 2147-10-04 06:01:00 225158 500.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 500.000000 500.000000
6 119123 42367 139932 250305 2147-10-27 03:35:00 2147-10-28 19:35:00 225158 200.000006 ml 5.000000 ... ml 0 0 2 Rewritten RN NaN 2147-10-28 22:13:00 200.000000 5.000000
7 119011 42367 139932 250305 2147-10-07 22:00:00 2147-10-07 22:01:00 223258 4.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 4.000000 4.000000
8 119144 42367 139932 250305 2147-10-05 14:30:00 2147-10-05 16:02:00 222168 32.167836 mg 4.995006 ... ml 0 0 0 Stopped NaN NaN NaN 191.608410 5.000000
9 119336 42367 139932 250305 2147-10-09 21:08:00 2147-10-09 21:09:00 225158 1.000000 ml 60.000000 ... ml 0 0 1 Rewritten NaN RN 2147-10-10 00:16:00 632.000000 60.000000
10 119163 42367 139932 250305 2147-10-12 17:00:00 2147-10-12 19:00:00 225158 2.000000 ml 1.000000 ... ml 0 0 0 Changed NaN NaN NaN 100.000000 1.000000
11 119357 42367 139932 250305 2147-10-20 10:00:00 2147-10-20 11:00:00 226089 99.999996 ml 99.999996 ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 100.000000
12 119185 42367 139932 250305 2147-10-09 00:07:00 2147-10-09 16:47:00 225158 1000.000000 ml 60.000000 ... ml 0 0 2 Rewritten RN NaN 2147-10-09 15:03:00 1000.000000 60.000000
13 119377 42367 139932 250305 2147-10-26 20:00:00 2147-10-26 20:01:00 226453 50.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 50.000000 50.000000
14 119685 42367 139932 250305 2147-10-19 14:32:00 2147-10-19 14:47:00 226089 99.999997 ml 399.999990 ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 400.000000
15 119531 42367 139932 250305 2147-10-13 17:31:00 2147-10-13 17:32:00 221794 0.033311 mg 1.998641 ... ml 0 0 0 Rewritten NaN NaN NaN 12.591438 2.000000
16 119725 42367 139932 250305 2147-10-14 05:57:00 2147-10-14 05:58:00 223258 0.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 0.000000 0.000000
17 119735 42367 139932 250305 2147-10-15 17:59:00 2147-10-15 18:14:00 226089 99.999997 ml 399.999990 ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 400.000000
18 118930 42367 139932 250305 2147-10-28 19:35:00 2147-10-30 11:35:00 225158 200.000006 ml 5.000000 ... ml 0 0 2 Rewritten RN NaN 2147-10-30 16:31:00 200.000000 5.000000
19 119264 42367 139932 250305 2147-10-04 19:14:00 2147-10-05 14:30:00 222168 810.666109 mg 10.018118 ... ml 0 0 0 Changed NaN NaN NaN 1000.000100 10.000000
20 119761 42367 139932 250305 2147-10-22 10:00:00 2147-10-22 10:01:00 226453 50.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 50.000000 50.000000
21 119440 42367 139932 250305 2147-10-14 10:00:00 2147-10-14 10:01:00 223258 5.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 5.000000 5.000000
22 119283 42367 139932 250305 2147-10-09 16:00:00 2147-10-09 16:01:00 223258 4.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 4.000000 4.000000
23 119605 42367 139932 250305 2147-10-06 08:00:00 2147-10-06 08:01:00 225974 5.000000 mg NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 5.000000 5.000000
24 119410 42367 139932 250305 2147-10-16 10:00:00 2147-10-16 10:01:00 223258 8.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 8.000000 8.000000
25 119464 42367 139932 250305 2147-10-13 17:22:00 2147-10-18 16:24:00 225156 2500.000035 mg 0.300036 ... ml 0 0 2 Rewritten RN NaN 2147-10-13 18:04:00 2500.000000 0.300000
26 119636 42367 139932 250305 2147-10-12 20:16:00 2147-10-12 20:17:00 221794 20.000001 mg NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 20.000000 20.000000
27 119672 42367 139932 250305 2147-10-11 05:30:00 2147-10-11 05:31:00 223258 8.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 8.000000 8.000000
28 119438 42367 139932 250305 2147-10-19 11:16:00 2147-10-19 11:17:00 225799 240.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 240.000000 240.000000
29 149189 43881 172454 214180 2104-09-25 20:00:00 2104-09-25 20:01:00 225943 10.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 10.000000 0.000000
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
411 1454659 41976 172082 253931 2200-03-18 20:16:00 2200-03-18 21:48:00 225158 8.719763 ml 5.686802 ... ml 0 0 0 Changed NaN NaN NaN 43.504032 5.681833
412 1454984 41976 172082 253931 2200-03-19 13:51:00 2200-03-19 13:52:00 225893 1.000000 dose NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 1.000000 1.000000
413 1454706 41976 172082 253931 2200-03-20 12:01:00 2200-03-20 13:04:00 225158 113.980261 ml 108.552630 ... ml 0 0 0 Changed NaN NaN NaN 550.000000 108.552630
414 1454609 41976 172082 253931 2200-03-19 02:25:00 2200-03-19 05:10:00 225158 7.824682 ml 2.845339 ... ml 0 0 0 Stopped NaN NaN NaN 15.080296 2.840916
415 1454638 41976 172082 253931 2200-03-22 10:00:00 2200-03-22 10:01:00 221744 74.999996 mcg NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 75.000000 75.000000
416 1454965 41976 172082 253931 2200-03-19 16:15:00 2200-03-19 21:47:00 222168 252.086079 mg 10.017090 ... ml 0 0 0 Paused NaN NaN NaN 270.309140 10.000000
417 1454871 41976 172082 253931 2200-03-25 00:00:00 2200-03-25 00:01:00 220949 100.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 0.000000
418 1454784 41976 172082 253931 2200-03-28 06:15:00 2200-03-28 09:33:00 220949 38.594960 ml 11.695442 ... ml 0 0 0 FinishedRunning NaN NaN NaN 38.594959 11.672711
419 1454749 41976 172082 253931 2200-03-17 22:51:00 2200-03-17 23:15:00 225158 6.825939 ml 17.064847 ... ml 0 0 0 Changed NaN NaN NaN 250.000000 17.045500
420 1454802 41976 172082 253931 2200-03-18 14:54:00 2200-03-20 16:54:00 225942 2.500000 mg 50.000003 ... ml 0 0 1 Rewritten NaN RN 2200-03-18 14:58:00 2.500000 50.000000
421 1659771 41976 152032 234541 2200-06-10 09:25:00 2200-06-10 10:25:00 226089 99.999996 ml 99.999996 ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 100.000000
422 1659803 41976 152032 234541 2200-06-11 11:17:00 2200-06-11 15:16:00 227979 240.000000 ml 60.251046 ... ml 0 0 0 FinishedRunning NaN NaN NaN 240.000000 60.251045
423 2027254 41976 130681 265505 2200-11-02 19:42:00 2200-11-02 19:43:00 220949 200.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 200.000000 0.000000
424 2027296 41976 130681 265505 2200-10-30 15:06:00 2200-10-30 15:07:00 225797 125.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 125.000000 125.000000
425 2027194 41976 130681 265505 2200-10-30 17:59:00 2200-10-30 18:00:00 223262 8.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 8.000000 8.000000
426 2027239 41976 130681 265505 2200-11-02 08:00:00 2200-11-02 08:01:00 226453 125.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 125.000000 125.000000
427 2027292 41976 130681 265505 2200-10-31 02:55:00 2200-10-31 02:56:00 225797 125.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 125.000000 125.000000
428 2027324 41976 130681 265505 2200-10-30 07:12:00 2200-10-30 07:13:00 225975 1.000000 dose NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 1.000000 1.000000
429 2027222 41976 130681 265505 2200-10-30 00:58:00 2200-10-30 00:59:00 225828 1000.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 1000.000000 1000.000000
430 2510990 41976 180546 285353 2201-05-13 07:23:00 2201-05-13 07:24:00 220949 100.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 0.000000
431 2847362 41976 125013 213315 2201-10-01 08:00:00 2201-10-01 08:01:00 226452 60.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 60.000000 60.000000
432 2847383 41976 125013 213315 2201-09-28 18:56:00 2201-09-28 21:21:00 221906 3.055802 mg 0.301064 ... ml 0 0 0 Changed NaN NaN NaN 6.764912 0.300000
433 2847429 41976 125013 213315 2201-09-30 13:01:00 2201-09-30 15:38:00 225152 3411.938130 units 1303.925400 ... ml 0 0 0 Rewritten NaN NaN NaN 3411.938000 1300.000000
434 2847390 41976 125013 213315 2201-09-29 06:32:00 2201-09-29 09:58:00 227979 188.414639 ml 54.878050 ... ml 0 0 0 Changed NaN NaN NaN 300.000000 55.000000
435 2847406 41976 125013 213315 2201-09-29 14:16:00 2201-09-29 22:36:00 221906 0.700005 mg 0.020000 ... ml 0 0 0 Stopped NaN NaN NaN 7.537649 0.020000
436 2951796 41976 155297 209797 2201-11-17 19:49:00 2201-11-17 19:50:00 225883 1.000000 dose NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 1.000000 1.000000
437 2951826 41976 155297 209797 2201-11-17 11:07:00 2201-11-17 11:08:00 225799 120.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 120.000000 120.000000
438 2951782 41976 155297 209797 2201-11-17 20:00:00 2201-11-18 02:40:00 225936 500.000000 ml 75.000000 ... ml 0 0 2 Rewritten RN NaN 2201-11-18 02:13:00 500.000000 75.000000
439 3173421 41976 151798 280943 2202-02-16 19:37:00 2202-02-16 19:38:00 226453 30.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 30.000000 30.000000
440 3173409 41976 151798 280943 2202-02-15 22:31:00 2202-02-15 23:25:00 220949 30.066814 ml 33.407572 ... ml 0 0 0 Changed NaN NaN NaN 250.000000 33.333302

441 rows × 31 columns

a) Take some variables for only numerical values and randomly insert characters into numbers.


In [74]:
# Sample Percentage
s_percent = .3
iter_times = math.ceil(file.shape[0] * s_percent)
num = 0 
num_row = file.shape[0] - 1
file['ITEMID'] = file['ITEMID'].astype(str)

# INSERT RANDOM CHARACTERS INTO NUMERICAL VALUES
while num < iter_times:
    row = randint(0, num_row)
    col = "ITEMID"
    s = file.loc[row][col]
    s = str(s)
    char = random.choice(string.ascii_letters)
    pos = randint(0, len(s) - 1)  # pick random position to insert char
    change = "".join((s[:pos], char, s[pos:]))  # insert char at pos
    file = file.set_value(row, col, change)
    num = num + 1

b) take variables that must not have nulls, and insert spaces


In [78]:
num = 0
file['SUBJECT_ID'] = file['SUBJECT_ID'].astype(str)

# REPLACES VALUES THAT SHOULD NOT BE NULL WITH SPACES
while num < iter_times:
    row = randint(0, num_row)
    col = "SUBJECT_ID"
    change = " "
    file = file.set_value(row, col, change)
    num = num + 1

c) look into some range values and insert values that are outside of these values.


In [83]:
num = 0

# INSERT VALUES OUTSIDE THE MIN/MAX RANGE
while num < iter_times:
    rand_low = randint(-1000, -1)
    rand_high = randint(25000, 50000)
    rand = [rand_low, rand_high]
    row = randint(0, num_row)
    col = "AMOUNT"
    change = random.choice(rand)
    file = file.set_value(row, col, change)
    num = num + 1

In [84]:
file


Out[84]:
ROW_ID SUBJECT_ID HADM_ID ICUSTAY_ID STARTTIME ENDTIME ITEMID AMOUNT AMOUNTUOM RATE ... TOTALAMOUNTUOM ISOPENBAG CONTINUEINNEXTDEPT CANCELREASON STATUSDESCRIPTION COMMENTS_EDITEDBY COMMENTS_CANCELEDBY COMMENTS_DATE ORIGINALAMOUNT ORIGINALRATE
0 119199 139932 250305 2147-10-21 23:42:00 2147-10-21 23:43:00 223r259 15.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 15.000000 15.000000
1 119080 139932 250305 2147-10-19 16:11:00 2147-10-19 16:12:00 226453 40.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 40.000000 40.000000
2 119227 42367 139932 250305 2147-10-28 19:56:00 2147-10-28 19:57:00 -942 32905.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 60.000000 60.000000
3 119110 42367 139932 250305 2147-10-14 11:15:00 2147-10-14 11:16:00 221744 49.999999 mcg NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 50.000000 50.000000
4 119244 42367 139932 250305 2147-10-18 16:30:00 2147-10-18 17:30:00 225166 20.000000 mEq NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 20.000000 0.333333
5 118991 42367 139932 250305 2147-10-04 06:00:00 2147-10-04 06:01:00 225158 500.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 500.000000 500.000000
6 119123 42367 139932 250305 2147-10-27 03:35:00 2147-10-28 19:35:00 22l5158 -874.000000 ml 5.000000 ... ml 0 0 2 Rewritten RN NaN 2147-10-28 22:13:00 200.000000 5.000000
7 119011 139932 250305 2147-10-07 22:00:00 2147-10-07 22:01:00 29508 -793.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 4.000000 4.000000
8 119144 42367 139932 250305 2147-10-05 14:30:00 2147-10-05 16:02:00 222M168 32.167836 mg 4.995006 ... ml 0 0 0 Stopped NaN NaN NaN 191.608410 5.000000
9 119336 42367 139932 250305 2147-10-09 21:08:00 2147-10-09 21:09:00 22515W8 1.000000 ml 60.000000 ... ml 0 0 1 Rewritten NaN RN 2147-10-10 00:16:00 632.000000 60.000000
10 119163 42367 139932 250305 2147-10-12 17:00:00 2147-10-12 19:00:00 -382 2.000000 ml 1.000000 ... ml 0 0 0 Changed NaN NaN NaN 100.000000 1.000000
11 119357 42367 139932 250305 2147-10-20 10:00:00 2147-10-20 11:00:00 226Z089 27462.000000 ml 99.999996 ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 100.000000
12 119185 139932 250305 2147-10-09 00:07:00 2147-10-09 16:47:00 Z225158 1000.000000 ml 60.000000 ... ml 0 0 2 Rewritten RN NaN 2147-10-09 15:03:00 1000.000000 60.000000
13 119377 139932 250305 2147-10-26 20:00:00 2147-10-26 20:01:00 226453 50.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 50.000000 50.000000
14 119685 42367 139932 250305 2147-10-19 14:32:00 2147-10-19 14:47:00 226089 99.999997 ml 399.999990 ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 400.000000
15 119531 42367 139932 250305 2147-10-13 17:31:00 2147-10-13 17:32:00 -348 0.033311 mg 1.998641 ... ml 0 0 0 Rewritten NaN NaN NaN 12.591438 2.000000
16 119725 42367 139932 250305 2147-10-14 05:57:00 2147-10-14 05:58:00 223258 45257.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 0.000000 0.000000
17 119735 139932 250305 2147-10-15 17:59:00 2147-10-15 18:14:00 226089 99.999997 ml 399.999990 ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 400.000000
18 118930 42367 139932 250305 2147-10-28 19:35:00 2147-10-30 11:35:00 225158 200.000006 ml 5.000000 ... ml 0 0 2 Rewritten RN NaN 2147-10-30 16:31:00 200.000000 5.000000
19 119264 42367 139932 250305 2147-10-04 19:14:00 2147-10-05 14:30:00 48421 810.666109 mg 10.018118 ... ml 0 0 0 Changed NaN NaN NaN 1000.000100 10.000000
20 119761 42367 139932 250305 2147-10-22 10:00:00 2147-10-22 10:01:00 226453 50.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 50.000000 50.000000
21 119440 42367 139932 250305 2147-10-14 10:00:00 2147-10-14 10:01:00 223258 5.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 5.000000 5.000000
22 119283 139932 250305 2147-10-09 16:00:00 2147-10-09 16:01:00 2W232l58 4.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 4.000000 4.000000
23 119605 42367 139932 250305 2147-10-06 08:00:00 2147-10-06 08:01:00 225974 5.000000 mg NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 5.000000 5.000000
24 119410 42367 139932 250305 2147-10-16 10:00:00 2147-10-16 10:01:00 223258 8.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 8.000000 8.000000
25 119464 139932 250305 2147-10-13 17:22:00 2147-10-18 16:24:00 225156 -370.000000 mg 0.300036 ... ml 0 0 2 Rewritten RN NaN 2147-10-13 18:04:00 2500.000000 0.300000
26 119636 42367 139932 250305 2147-10-12 20:16:00 2147-10-12 20:17:00 221794 49875.000000 mg NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 20.000000 20.000000
27 119672 139932 250305 2147-10-11 05:30:00 2147-10-11 05:31:00 -535 8.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 8.000000 8.000000
28 119438 139932 250305 2147-10-19 11:16:00 2147-10-19 11:17:00 225N799 -125.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 240.000000 240.000000
29 149189 172454 214180 2104-09-25 20:00:00 2104-09-25 20:01:00 -897 10.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 10.000000 0.000000
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
411 1454659 41976 172082 253931 2200-03-18 20:16:00 2200-03-18 21:48:00 225158 8.719763 ml 5.686802 ... ml 0 0 0 Changed NaN NaN NaN 43.504032 5.681833
412 1454984 172082 253931 2200-03-19 13:51:00 2200-03-19 13:52:00 -16 33228.000000 dose NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 1.000000 1.000000
413 1454706 41976 172082 253931 2200-03-20 12:01:00 2200-03-20 13:04:00 44445 113.980261 ml 108.552630 ... ml 0 0 0 Changed NaN NaN NaN 550.000000 108.552630
414 1454609 41976 172082 253931 2200-03-19 02:25:00 2200-03-19 05:10:00 225158 7.824682 ml 2.845339 ... ml 0 0 0 Stopped NaN NaN NaN 15.080296 2.840916
415 1454638 172082 253931 2200-03-22 10:00:00 2200-03-22 10:01:00 221744 74.999996 mcg NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 75.000000 75.000000
416 1454965 172082 253931 2200-03-19 16:15:00 2200-03-19 21:47:00 2r22168 252.086079 mg 10.017090 ... ml 0 0 0 Paused NaN NaN NaN 270.309140 10.000000
417 1454871 41976 172082 253931 2200-03-25 00:00:00 2200-03-25 00:01:00 220949 100.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 0.000000
418 1454784 41976 172082 253931 2200-03-28 06:15:00 2200-03-28 09:33:00 220949 29315.000000 ml 11.695442 ... ml 0 0 0 FinishedRunning NaN NaN NaN 38.594959 11.672711
419 1454749 172082 253931 2200-03-17 22:51:00 2200-03-17 23:15:00 -410 6.825939 ml 17.064847 ... ml 0 0 0 Changed NaN NaN NaN 250.000000 17.045500
420 1454802 41976 172082 253931 2200-03-18 14:54:00 2200-03-20 16:54:00 22y5942 -376.000000 mg 50.000003 ... ml 0 0 1 Rewritten NaN RN 2200-03-18 14:58:00 2.500000 50.000000
421 1659771 41976 152032 234541 2200-06-10 09:25:00 2200-06-10 10:25:00 226089 99.999996 ml 99.999996 ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 100.000000
422 1659803 41976 152032 234541 2200-06-11 11:17:00 2200-06-11 15:16:00 34802 34918.000000 ml 60.251046 ... ml 0 0 0 FinishedRunning NaN NaN NaN 240.000000 60.251045
423 2027254 41976 130681 265505 2200-11-02 19:42:00 2200-11-02 19:43:00 29243 200.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 200.000000 0.000000
424 2027296 41976 130681 265505 2200-10-30 15:06:00 2200-10-30 15:07:00 42287 125.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 125.000000 125.000000
425 2027194 41976 130681 265505 2200-10-30 17:59:00 2200-10-30 18:00:00 223262 8.000000 units NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 8.000000 8.000000
426 2027239 130681 265505 2200-11-02 08:00:00 2200-11-02 08:01:00 -458 125.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 125.000000 125.000000
427 2027292 41976 130681 265505 2200-10-31 02:55:00 2200-10-31 02:56:00 -154 125.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 125.000000 125.000000
428 2027324 41976 130681 265505 2200-10-30 07:12:00 2200-10-30 07:13:00 22M5975 1.000000 dose NaN ... NaN 0 0 0 FinishedRunning NaN NaN NaN 1.000000 1.000000
429 2027222 130681 265505 2200-10-30 00:58:00 2200-10-30 00:59:00 -268 1000.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 1000.000000 1000.000000
430 2510990 180546 285353 2201-05-13 07:23:00 2201-05-13 07:24:00 C220949 -582.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 100.000000 0.000000
431 2847362 41976 125013 213315 2201-10-01 08:00:00 2201-10-01 08:01:00 43311 -504.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 60.000000 60.000000
432 2847383 41976 125013 213315 2201-09-28 18:56:00 2201-09-28 21:21:00 221906 3.055802 mg 0.301064 ... ml 0 0 0 Changed NaN NaN NaN 6.764912 0.300000
433 2847429 41976 125013 213315 2201-09-30 13:01:00 2201-09-30 15:38:00 225152 3411.938130 units 1303.925400 ... ml 0 0 0 Rewritten NaN NaN NaN 3411.938000 1300.000000
434 2847390 125013 213315 2201-09-29 06:32:00 2201-09-29 09:58:00 227979 188.414639 ml 54.878050 ... ml 0 0 0 Changed NaN NaN NaN 300.000000 55.000000
435 2847406 125013 213315 2201-09-29 14:16:00 2201-09-29 22:36:00 221PY906 0.700005 mg 0.020000 ... ml 0 0 0 Stopped NaN NaN NaN 7.537649 0.020000
436 2951796 41976 155297 209797 2201-11-17 19:49:00 2201-11-17 19:50:00 -816 1.000000 dose NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 1.000000 1.000000
437 2951826 41976 155297 209797 2201-11-17 11:07:00 2201-11-17 11:08:00 -516 120.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 120.000000 120.000000
438 2951782 41976 155297 209797 2201-11-17 20:00:00 2201-11-18 02:40:00 225936 500.000000 ml 75.000000 ... ml 0 0 2 Rewritten RN NaN 2201-11-18 02:13:00 500.000000 75.000000
439 3173421 41976 151798 280943 2202-02-16 19:37:00 2202-02-16 19:38:00 226453 30.000000 ml NaN ... ml 0 0 0 FinishedRunning NaN NaN NaN 30.000000 30.000000
440 3173409 41976 151798 280943 2202-02-15 22:31:00 2202-02-15 23:25:00 e220949 30.066814 ml 33.407572 ... ml 0 0 0 Changed NaN NaN NaN 250.000000 33.333302

441 rows × 31 columns


In [80]:
file['AMOUNT'].describe()


Out[80]:
count      441.000000
mean       245.067554
std       1321.189992
min          0.000000
25%          3.055802
50%         30.000000
75%        112.900000
max      24166.666672
Name: AMOUNT, dtype: float64

In [36]:
#change = file.sample(1)

In [85]:
#file.loc[change,'ITEMID'] = 0

In [ ]:


In [ ]:


In [ ]: