This repository showcases the application of artificial intelligence directly to the traditional Pandas library. pandasAI enables data analysis with Python by utilizing text-based, human-like conversations. This is made possible using GenAI, allowing users to perform data analysis tasks with simple text prompts, eliminating the need for traditional code-based workflows.
PandasAI revolutionizes the way data analysis is performed using the Pandas library. By leveraging artificial intelligence and natural language processing techniques, pandasAI enables users to interact with data through text-based conversations. This simplifies the data analysis process and makes it more accessible to a wider audience, eliminating the need for writing complex code.
To use the PandasAI library, follow these steps:
- Install pandasAI using pip:
pip install pandasAI
- Import the library in your Python script:
import pandasAI as pdai
- Ensure you have the required dependencies installed, such as Pandas and GenAI.
- Import the PandasAI library:
import pandasAI as pdai
- Load your dataset using Pandas:
df = pdai.read_csv('dataset.csv')
- Perform data analysis tasks by interacting with the data using text prompts and commands.
- Utilize available functions and methods provided by PandasAI for data manipulation, exploration, visualization, and more.
This guide will walk you through the process of getting started with PandasAI. There are two approaches you can take to use PandasAI: using LangChain models and direct implementation.
To use LangChain models, you first need to install the Langchain package:
pip install langchain
Once installed, you can instantiate a LangChain object in your code:
from pandasai import PandasAI
from langchain.llms import OpenAI
langchain_llm = OpenAI(openai_api_key="my-openai-api-key")
pandasai = PandasAI(llm=langchain_llm)
With these steps, your environment is now ready, and PandasAI will automatically utilize the LangChain llm and convert it to a PandasAI llm.
If you prefer a direct implementation without using LangChain, follow these steps:
- Start by installing PandasAI as it may not be preinstalled like Pandas:
pip install pandasai
- Another crucial requirement is an OpenAI API key to use PandasAI. You can create an API key with an account on the OpenAI platform. Visit OpenAI Account API Keys to create a key.
Make sure to keep your API key secure and follow best practices for handling API keys.
Once you have completed these steps, you can start using PandasAI for your data analysis tasks.
The following examples demonstrate how pandasAI simplifies data analysis tasks:
Contributions to pandasAI are welcome. To contribute, follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature
- Make your changes and commit them:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/your-feature
- Submit a pull request.
This project is licensed under the MIT License.
The official GitHub repository for pandasAI can be found at: https://github.com/gventuri/pandas-ai