filmov
tv
Memory Efficient Dataframes from MASSIVE SQL Queries!!! #python #datascience #pandas #sql #coding

Показать описание
Have you ever wondered how to create memory-efficient pandas dataframes with python? In this short I demonstrate just how easy it is by using panda's chunksize argument.
Here is the source code:
# Libraries
import pandas as pd
import sqlalchemy
from sqlalchemy import create_engine
# Creating SQL Alchemy engine object
# Initiailizing connection to database
sql = "SELECT * FROM players"
# Demonstrating individual chunks
print(chunk)
# Function to query in chunks and concat results into a final dataframe
def chunkDF(sql, conn, chunksize):
return final_df
# Passing the results of the function to a dataframe
df = chunkDF(sql, conn, 100)
Here is the source code:
# Libraries
import pandas as pd
import sqlalchemy
from sqlalchemy import create_engine
# Creating SQL Alchemy engine object
# Initiailizing connection to database
sql = "SELECT * FROM players"
# Demonstrating individual chunks
print(chunk)
# Function to query in chunks and concat results into a final dataframe
def chunkDF(sql, conn, chunksize):
return final_df
# Passing the results of the function to a dataframe
df = chunkDF(sql, conn, 100)
Memory Efficient Dataframes from MASSIVE SQL Queries!!! #python #datascience #pandas #sql #coding
Python Pandas Tutorial 15. Handle Large Datasets In Pandas | Memory Optimization Tips For Pandas
Working with larger-than-memory datasets with Polars
Process HUGE Data Sets in Pandas
Processing large files in parallel with minimal memory usage
Dask DataFrames Tutorial: Best practices for larger-than-memory dataframes
Speed Up Your Pandas Dataframes
Stop wasting memory in your Pandas DataFrame!
Pandas Memory Optimization Tips
This INCREDIBLE trick will speed up your data processes.
Reading Large File as Pandas DataFrame Memory Error Issue
How to process large dataset with pandas | Avoid out of memory issues while loading data into pandas
Make Your Pandas Code Lightning Fast
Optimizing Pandas DataFrame Performance: Practical Tips for Better Performance
Dask Memory Management in 7 Minutes: An Introduction
R : pivot_longer with a very big data.frame, memory efficient approaches
Do I need more memory to query a HUGE table?
PYTHON : Is there a memory efficient and fast way to load big JSON files?
Python Tutorial: Using iterators to load large files into memory
Three ways to optimize your Pandas data frame's memory footprint
STOP Strings, Use Category, Don't BLOW Your Memory (Pandas)
Efficient Data Analysis on Larger-than-Memory Data with DuckDB and Arrow
Polars: The Next Big Python Data Science Library... written in RUST?
Claudio Freire - Efficient shared memory data structures - PyCon 2018
Комментарии