In [4]:
import numpy as np
In [10]:
a = np.array( [ [1,0,2,4,3] , [7,2,3,1,4] ] )
In [11]:
a
Out[11]:
In [14]:
np.flip(a,1)
Out[14]:
In [1]:
CAR_COLORS_NO_HASH = ['7FFF00', '7FFFD4', 'D2691E', '8B008B', 'BDB76B',\
'8B0000', 'FF1493', '1E90FF', 'FFD700', 'ADFF2F', \
'CD5C5C', 'F0E68C']
In [2]:
with_hash = ['#'+x for x in CAR_COLORS_NO_HASH]
with_hash
Out[2]:
In [6]:
arr = np.resize(np.arange(36),[6,6])
In [7]:
arr
Out[7]:
In [29]:
np.flip(arr,1)
Out[29]:
In [20]:
arr[:,2]
Out[20]:
In [26]:
?np.flip
In [30]:
import sqlite3
In [36]:
conn = sqlite3.connect('rush_hour.db')
In [37]:
cur = conn.cursor()
In [38]:
sql = 'select count(1) from segment where num_v_cars = 4 and num_h_cars=2 and num_v_trucks=0 and num_h_trucks=1'
In [39]:
sql
Out[39]:
In [47]:
cur.execute(sql)
count = cur.fetchone()[0]
In [44]:
cur.fetchone()
In [48]:
arr
Out[48]:
In [49]:
x = np.array( [ [1,2,3,4] , [2,3,4,6] ] )
x
Out[49]:
In [58]:
np.size( x[x==3] )
Out[58]:
In [60]:
VERTICAL_CAR = int('101',2)
np.size(x[x==VERTICAL_CAR])
Out[60]:
In [ ]: