Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to fetch limited rows in pandas dataframe using sqlalchemy

import sqlalchemy as db
import pandas as pd

engine = db.create_engine('sqlite:///traffic.sqlite') # just for example
con=engine.connect()
dbqu=con.execute("SELECT * FROM vehicles")
## use fetchmany(size=x) instead of fetchall() to fetch x number of rows
df=pd.DataFrame(dbqu.fetchmany(size=20))  
con.close()
Comment

PREVIOUS NEXT
Code Example
Python :: python cos not the same as calculator 
Python :: NumPy unique Example Identify the index of the first occurrence of unique values 
Python :: NumPy bitwise_and Example When inputs are numbers 
Python :: using Canvas with tkinger 
Python :: else clause in for loop python 
Python :: python fft 
Python :: saving specific column with pd 
Python :: NumPy packbits Code Packed array along default axis 
Python :: how to do something daily python 
Python :: wget http://xael.org/norman/python/python-nmap/pythonnmap- 0.2.4.tar.gz-On map.tar.gz 
Python :: # find all text files in directory or any type of files in directory 
Python :: adjoint of 3x3 matrix in python 
Python :: get primary key in get_context_data 
Python :: get token eth balance python 
Python :: QDateEdit.date().toString("MMMM dd, yyyy") does not display months in English 
Python :: rasa emotion bot 
Python :: dnpy notify 
Python :: map function in pyhton 
Python :: gitlab ci deploy key 
Python :: Trying to use image in Flask website only shows broken img icon 
Python :: get type of enum variable python 
Python :: dataframe get missing and zero values 
Python :: sns.kdeplot make line more detailed 
Python :: while loop using increment 
Python :: how to insert a character into a string in python 
Python :: dateentry python centered 
Python :: what is primary key in python 
Python :: range function in python use cases 
Python :: tkinter file dialog multiple file types 
Python :: rolingmean python 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =