프로젝트 소개

# PandasAI PandasAI는 자연어로 데이터에 질문할 수 있게 해주는 Python 라이브러리입니다. 비기술 사용자가 데이터와 더 자연스럽게 상호작용하도록 돕고, 기술 사용자가 데이터 작업 시 시간과 노력을 절약하도록 돕습니다. ## 시작하기 전체 문서는 [docs.pandas-ai.com](https://docs.pandas-ai.com/)에서 확인할 수 있습니다. ### Python 요구 사항 Python 버전 `3.8+ <=3.11` ### 설치 pip로 설치: ```bash pip install pandasai pip install pandasai-litellm ``` 또는 poetry로 설치: ```bash poetry add pandasai poetry add pandasai-litellm ``` ### 사용법 #### 질문하기 ```python import pandasai as pai from pandasai_litellm.litellm import LiteLLM # Initialize LiteLLM with your OpenAI model llm = LiteLLM(model="gpt-4.1-mini", api_key="YOUR_OPENAI_API_KEY") # Configure PandasAI to use this LLM pai.config.set({ "llm": llm }) # Load your data df = pai.read_csv("data/companies.csv") response = df.chat("What is the average revenue by region?") print(response) ``` 더 복잡한 질문도 할 수 있습니다: ```python df.chat( "What is the total sales for the top 3 countries by sales?" ) ``` 출력: `The total sales for the top 3 countries by sales is 16500.` #### 차트 시각화 PandasAI는 차트를 생성할 수 있습니다: ```python df.chat( "Plot the histogram of countries showing for each one the gdp. Use different colors for each bar", ) ``` #### 여러 DataFrame 여러 데이터프레임을 전달하고 이들과 관련된 질문을 할 수 있습니다: ```python import pandasai as pai from pandasai_litellm.litellm import LiteLLM llm = LiteLLM(model="gpt-4.1-mini", api_key="YOUR_OPENAI_API_KEY") pai.config.set({"llm": llm}) employees_data = { 'EmployeeID': [1, 2, 3, 4, 5], 'Name': ['John', 'Emma', 'Liam', 'Olivia', 'William'], 'Department': ['HR', 'Sales', 'IT', 'Marketing', 'Finance'] } salaries_data = { 'EmployeeID': [1, 2, 3, 4, 5], 'Salary': [5000, 6000, 4500, 7000, 5500] } employees_df = pai.DataFrame(employees_data) salaries_df = pai.DataFrame(salaries_data) pai.chat("Who gets paid the most?", employees_df, salaries_df) ``` 출력: `Olivia gets paid the most.` #### Docker 샌드박스 안전하고 격리된 코드 실행을 위해 Docker 샌드박스에서 PandasAI를 실행하세요: ```bash pip install "pandasai-docker" ``` ```python import pandasai as pai from pandasai_docker import DockerSandbox from pandasai_litellm.litellm import LiteLLM llm = LiteLLM(model="gpt-4.1-mini", api_key="YOUR_OPENAI_API_KEY") pai.config.set({"llm": llm}) sandbox = DockerSandbox() sandbox.start() # ... create dataframes ... pai.chat("Who gets paid the most?", employees_df, salaries_df, sandbox=sandbox) sandbox.stop() ``` 더 많은 예제는 [examples](examples) 디렉터리에 있습니다. ## 라이선스 PandasAI는 MIT expat 라이선스로 제공되며, 자체 라이선스를 가진 `pandasai/ee` 디렉터리는 예외입니다. 관리형 PandasAI Cloud 또는 자체 호스팅 Enterprise Offering은 요청 시 이용할 수 있습니다. ## 리소스 - [Docs](https://docs.pandas-ai.com/) - [Examples](examples) - [Discord](https://discord.gg/KYKj9F2FRH) ## 기여 기여를 환영합니다! 미해결 이슈를 확인하고 자유롭게 풀 리퀘스트를 열어 주세요. [기여 가이드라인](CONTRIBUTING.md)을 참고하세요.