forked from cryptobuks/magic-analyst-IPython-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagic.py
More file actions
30 lines (21 loc) · 755 Bytes
/
magic.py
File metadata and controls
30 lines (21 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from IPython.core.magic import register_line_magic
from langchain.agents import create_csv_agent
from main import llm, kaggle, agent
@register_line_magic
def search(line):
return kaggle.search(line)
@register_line_magic
def download(line):
agent.run(
"Download {dataset} and extract and create dataframes from it".format(
dataset=line
)
)
@register_line_magic
def eda(line):
csv_agent = create_csv_agent(llm, line, verbose=True)
csv_agent.run("Write a detailed exploratory data analysis for this dataset")
def load_ipython_extension(ipython):
ipython.register_magic_function(search, "line")
ipython.register_magic_function(download, "line")
ipython.register_magic_function(eda, "line")