Skip to Content
Hands-On Convolutional Neural Networks with TensorFlow
book

Hands-On Convolutional Neural Networks with TensorFlow

by Iffat Zafar, Giounona Tzanidou, Richard Burton, Nimesh Patel, Leonardo Araujo
August 2018
Intermediate to advanced
272 pages
7h 2m
English
Packt Publishing
Content preview from Hands-On Convolutional Neural Networks with TensorFlow

Doing queries in Python

First, before we start playing around, we need to install the Python driver pip install cassandra-driver​; the following snippet of code just lists the content of a table in the Cassandra cluster:

from cassandra.cluster import Cluster​ 
import cassandra.util​ 
import uuid​ 
import numpy as np​ 
​ 
# Considering that the cluster is on localhost​ 
cluster = Cluster()​ 
# Other option if you know the IPs​ 
# cluster = Cluster(['192.168.0.1', '192.168.0.2'])​ 
# Get a session to the database​ 
session = cluster.connect('mydb')​ 
​ 
# Doing a query​ 
rows = session.execute('SELECT * FROM tb_drive limit 5')​ 
print('Columns:',rows.column_names)​ 
for row in rows:​ 
    print(row.id, row.acc, row.wheel_angle) 
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Computer Vision Using Deep Learning: Neural Network Architectures with Python and Keras

Computer Vision Using Deep Learning: Neural Network Architectures with Python and Keras

Vaibhav Verdhan

Publisher Resources

ISBN: 9781789130331Supplemental Content