Skip to content

Commit

Permalink
docs: Rectify code examples by adding missing statements (#915)
Browse files Browse the repository at this point in the history
Anyone who is quite new to python won't be able to simplify code errors when directly copied code demo from official website.

Updated code example is taken from the root README.md and tested.
  • Loading branch information
HemantSachdeva authored Jan 31, 2024
1 parent c2e37b1 commit f145da9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Once you have installed PandasAI, you can start using it by importing it into yo
Now you can start asking questions to your data in natural language. For example, the following code will ask PandasAI to find all the rows in a DataFrame where the value of the `gdp` column is greater than 5:

```python
import pandas as pd
from pandasai import SmartDataframe

df = pd.DataFrame({
Expand All @@ -56,7 +57,11 @@ df = pd.DataFrame({
],
})

df = SmartDataframe(df)
# Instantiate a LLM
from pandasai.llm import OpenAI
llm = OpenAI(api_token="YOUR_API_TOKEN") # Get API token from https://platform.openai.com/account/api-keys

df = SmartDataframe(df, config={"llm": llm})
df.chat('Which are the countries with GDP greater than 3000000000000?')
# Output:
# 0 United States
Expand Down

0 comments on commit f145da9

Please sign in to comment.