Skip to content

Commit 8ebb627

Browse files
Merge pull request #1 from DashyDashOrg/v0.0.4
V0.0.4
2 parents 9a1b5ac + dee9567 commit 8ebb627

File tree

5 files changed

+170
-86
lines changed

5 files changed

+170
-86
lines changed

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ import os
2323
import pandas as pd
2424
from pandas_llm import PandasLLM
2525

26-
# your key
27-
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
28-
2926
# Data
3027
# Please note that these names, ages, and donations are randomly generated
3128
# and do not correspond to real individuals or their donations.
@@ -41,10 +38,12 @@ data = [('John Doe', 25, 50),
4138
('Olivia Jackson', 29, 55)]
4239
df = pd.DataFrame(data, columns=['name', 'age', 'donation'])
4340

44-
conv_df = PandasLLM(data=df, config={ "openai_api_key":OPENAI_API_KEY})
41+
conv_df = PandasLLM(data=df, openai_api_key = os.environ.get("OPENAI_API_KEY"))
4542
result = conv_df.prompt("What is the average donation of people older than 30 who donated more than $50?")
4643

4744
print(f"Result ({type(result)}):\n {result}")
45+
# Result (<class 'numpy.float64'>):
46+
# 75.0
4847
```
4948

5049
## Contributing

pandas_llm/example-chatbot.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pandas_llm import PandasLLM
99

1010
# Data
11+
# Please note that these names, ages, and donations are randomly generated and do not correspond to real individuals or their donations.
1112
data = [('John Doe', 25, 50),
1213
('Jane Smith', 38, 70),
1314
('Alex Johnson', 45, 80),
@@ -54,19 +55,15 @@ def main():
5455
print("No OpenAI API key provided. Exiting.")
5556
return
5657

57-
config = {
58-
"openai_api_key":openai_key
59-
}
60-
61-
conv_df = PandasLLM(data=df, config=config)
58+
conv_df = PandasLLM(data=df, llm_api_key = openai_key)
6259
print()
6360
banner = """
6461
Welcome to the Donation Data CLI.
6562
The donation dataset has three columns (name, age, donation)
6663
Please note that these names, ages, and donations are randomly generated and do not correspond to real individuals or their donations.
6764
6865
You can ask questions like:
69-
- show me the name of donators
66+
- show me the name of donors
7067
- What is the average age of people who donated?
7168
- What is the average donation amount?
7269
- What is the average donation of people older than 30?

pandas_llm/example.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
import pandas as pd
33
from pandas_llm import PandasLLM
44

5-
# your key
6-
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
7-
85
# Data
96
# Please note that these names, ages, and donations are randomly generated
107
# and do not correspond to real individuals or their donations.
@@ -20,8 +17,9 @@
2017
('Olivia Jackson', 29, 55)]
2118
df = pd.DataFrame(data, columns=['name', 'age', 'donation'])
2219

23-
conv_df = PandasLLM(data=df, config={ "openai_api_key":OPENAI_API_KEY})
20+
conv_df = PandasLLM(data=df, llm_api_key = os.environ.get("OPENAI_API_KEY"))
2421
result = conv_df.prompt("What is the average donation of people older than 30 who donated more than $50?")
2522

2623
print(f"Result ({type(result)}):\n {result}")
27-
24+
# Result (<class 'numpy.float64'>):
25+
# 75.0

0 commit comments

Comments
 (0)