-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtmap.py
41 lines (30 loc) · 1.08 KB
/
htmap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import pymssql
import pandas as pd
from datetime import datetime
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
cnxn = pymssql.connect( database = 'semi_c3_standardized' , server = '52.172.199.52',port = 1433, user = 'rishi', password = '9731449873')
#time = 'select accountholderid, trxndatetime from semi_c3_standardized.dbo.semic3_upi_trxndetails '
time = 'select top 1000 * from semi_c3_standardized.dbo.semic3_upi_trxndetails '
times = pd.read_sql(time,cnxn)
print(times.describe())
for i in [0,1,6,7] :
times[times.ix[:,i].apply(lambda x: isinstance(x, (int, np.int64)))]
y = times.ix[:,10]
y = y.apply( lambda x: x.date())
x = times.ix[:,1]
c = times.ix[:,9]
z = times.ix[:,11]
print(y.min())
def mad(data, axis=None):
return np.mean(np.abs(data - np.mean(data, axis)), axis)
_mad = np.abs(z - np.median(z)) / mad(z)
# Standard deviation
_sd = np.abs(z - np.mean(z)) / np.std(z)
#print(_mad)
#print (_sd)
ax.scatter(x, y, z, c=c, cmap=plt.hot())
plt.show()