판다스 자체는 비동기적으로 설계되지 않았지만, 데이터를 비동기적으로 처리하거나 병렬 처리를 활용할 수 있도록 도와주는 라이브러리나 프레임워크가 존재합니다. 판다스와 유사한 기능을 제공하면서 비동기식 데이터 처리를 지원하거나, 판다스를 확장하여 비동기 기능을 추가한 솔루션들이 있습니다.
import dask.dataframe as dd
# CSV 파일 읽기 (대용량 데이터 지원)
df = dd.read_csv('large_dataset.csv')
# 작업 수행
result = df.groupby('column_name').mean()
# 결과 계산 (지연 실행)
result = result.compute()
print(result)
import modin.pandas as pd
# Modin을 사용해 데이터 읽기
df = pd.read_csv("large_dataset.csv")
# Modin의 병렬 처리로 연산 수행
result = df.groupby("column_name").mean()
print(result)
import vaex
# CSV 파일 읽기
df = vaex.open('large_dataset.csv')
# Lazy Execution으로 그룹화 연산
result = df.groupby("column_name", agg="mean")
print(result)
import pandas as pd
import asyncio
async def load_and_process(file_path):
# CSV 읽기
df = pd.read_csv(file_path)
# 데이터 처리
result = df.groupby('column_name').mean()
return result
async def main():
files = ['file1.csv', 'file2.csv', 'file3.csv']
tasks = [load_and_process(file) for file in files]
results = await asyncio.gather(*tasks)
print(results)
asyncio.run(main())
import polars as pl
# CSV 파일 읽기
df = pl.read_csv("large_dataset.csv")
# 작업 수행
result = df.groupby("column_name").mean()
print(result)