import sqlite3 import pandas.io.sql as sql con = sqlite3.connect('networkmonitor.db') command = '''select cell_signal_strength_dbm,device_latitude,device_longitude from networkmonitor where network_type !='WIFI' and network_type !='MOBILE/LTE' and device_latitude not NULL and cell_signal_strength_dbm not NULL''' table = sql.read_frame(command, con) table.to_csv('networkmonitor.csv')