Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to pass a data frame as parameter to a SQL query in Python?

import pandas as pd

your_column = pd.Series([1,2,3,4,5,6,7,8,9])

query = "SELECT ValueDate, Value"
        "FROM Table "
        "WHERE [ID] in {}".format(tuple(your_column))

print(query)
# 'SELECT ValueDate, ValueFROM Table WHERE [ID] in (1, 2, 3, 4, 5, 6, 7, 8, 9)'
Comment

PREVIOUS NEXT
Code Example
Python :: center fig legend 
Python :: numpy move columns 
Python :: replicate python 
Python :: supervisor gunicorn virtualenv flask 
Python :: python forward and bachward seperators 
Python :: how to discover which index labels are in other 
Python :: python tkinter window size 
Python :: how to use wbtools in python 
Python :: how to get current user info in odoo 8 in a controller 
Python :: withdraw() opposite tjinter 
Python :: how to convert string labels to numpy array 
Python :: pythongalaxy.com 
Python :: what takes more memory string or list python 
Python :: sklearn recognising sentences 
Python :: dict_leys to list 
Python :: inspect last 5 rows of dataframe 
Python :: aiml python install 
Python :: create a fibonacci function using a generator python 
Python :: get the values of your aws tags from ec2 instance 
Python :: Read large SAS file ilarger than memory n Python 
Python :: list all subdirectories up to a level 
Python :: cross-validation sklearn image classification 
Python :: multiply two list in python using lambda 
Python :: factorial python 
Python :: get all non numeric columns pandas 
Python :: round(len(required_skills.intersection(resume_skills)) / len(required_skills) * 100, 0) 
Python :: Find number of triangles that can be made by given sides of triangle 
Python :: how to make a new df from old 
Python :: Specifying your data type 
Python :: Find Factors of a Number Using Class 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =