AI Personal Learning
and practical guidance
豆包Marscode1

PandasAI: Data Analytics Dialog Platform for Data Queries and Chart Generation in Natural Language

General Introduction

PandasAI is a Python-based open source platform designed to simplify the process of analyzing data through natural language processing techniques. It enables users to interact with databases (e.g. SQL, CSV, pandas, polars, mongodb, noSQL, etc.) in a conversational manner. The platform utilizes large-scale language models (e.g., GPT-3.5/4, Anthropic, VertexAI) and Retrieval Augmented Generation (RAG) technologies to make data analysis more intuitive and efficient for both technical and non-technical users.

PandasAI:数据分析对话平台,用自然语言完成数据查询与图表生成-1


 

 

Function List

  • natural language query: Easy access to data analysis results through natural language questioning.
  • data visualization: Generate charts and graphs to visualize data.
  • Data Cleaning: Dealing with missing values to improve data quality.
  • Feature Generation: Enhance the dataset by generating new features.
  • Multiple Data Source Support: Connect to CSV, XLSX, PostgreSQL, MySQL, BigQuery and many other data sources.
  • Multi-model support: Integration of GPT 3.5/4, Anthropic, VertexAI and other multi-language models.

 

Using Help

Installation process

  1. Installing Docker : Make sure you have Docker installed on your machine.
  2. clone warehouse : Rungit clone https://github.com/Sinaptik-AI/pandas-aiThe
  3. Building platforms : Go to the project directory and rundocker-compose buildThe
  4. Launch platform : Rundocker-compose upand then visithttp://localhost:3000The

Using the PandasAI library

  1. installer ::
    • Use pip:pip install pandasai
    • Use poetry:poetry add pandasai
  2. import library ::
import os
import pandas as pd
from pandasai import Agent
  1. Creating Data Frames ::
sales_by_country = pd.DataFrame({
"country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
"revenue": [5000, 3200, 2900, 4100, 2300, 2100, 2500, 2600, 4500, 7000]
})
  1. Configuring the API Key ::
os.environ["PANDASAI_API_KEY"] = "YOUR_API_KEY"
  1. Create Agent and Query ::
agent = Agent(sales_by_country)
response = agent.chat('Which are the top 5 countries by sales?')
print(response)
  1. Generate Charts ::
agent.chat("Plot the histogram of countries showing for each one the gd. Use different colors for each bar")

Using the PandasAI platform

  1. Access platforms : Post-startup accesshttp://localhost:3000The
  2. Upload data : Upload CSV or Excel files through the interface.
  3. natural language query : Enter a question in the query box, e.g. "Which are the top 5 countries by sales?".
  4. View Results : The platform will return the results of the query and optionally generate the appropriate charts.

PandasAI is suitable for a variety of data analysis scenarios, whether for business analysis, academic research or personal projects. With natural language processing technology, users can easily get valuable information from data without writing complex code.

May not be reproduced without permission:Chief AI Sharing Circle " PandasAI: Data Analytics Dialog Platform for Data Queries and Chart Generation in Natural Language
en_USEnglish