Search
 
SCRIPT & CODE EXAMPLE
 

SQL

can pandas fetch data from sql

import pandas as pd
import sqlite3

con = sqlite3.connect("data/portal_mammals.sqlite")

# Load the data into a DataFrame
surveys_df = pd.read_sql_query("SELECT * from surveys", con)

# Select only data for 2002
surveys2002 = surveys_df[surveys_df.year == 2002]

# Write the new DataFrame to a new SQLite table
surveys2002.to_sql("surveys2002", con, if_exists="replace")

con.close()
Comment

PREVIOUS NEXT
Code Example
Sql :: timing sql queries 
Sql :: find employee with max salary sql 
Sql :: spark sql grows beyond 64 kb 
Sql :: kill mysqld_safe process mariadb 
Sql :: run sql script file and changes db name in this file using c# 
Sql :: how to retrive image from sql to picturebox usinf image location 
Csharp :: oncollisionenter is declared but never used 
Csharp :: unity string split 
Csharp :: read text file to string c# 
Csharp :: how to make c# open brower 
Csharp :: c# replace all non numeric characters 
Csharp :: ngrok for asp.net core 
Csharp :: how to get ip address in c# 
Csharp :: bitmasking in c# 
Csharp :: c# Escape sequence 
Csharp :: Getting data from selected datagridview row and which event 
Csharp :: kotlin random number 
Csharp :: split with multiple delimiters c# 
Csharp :: unity editor select object in script 
Csharp :: unity move left and right 
Csharp :: linq unique count property 
Csharp :: c# int to bool 
Csharp :: c# base64 decode 
Csharp :: c# length 2d array 
Csharp :: how to exit application c# console 
Csharp :: how to make c# program run cmd commands 
Csharp :: get host ip address asp.net core 
Csharp :: require admin privileges c# 
Csharp :: message box in visual studio 
Csharp :: ef core dbfirst 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =