<jupyter_start><jupyter_text>Groovy Magic测试<jupyter_code>%%groovy

h = HTML("<h1 style='color:#8080DD'>Groovy HTML示例</h1>")
%%groovy

def p = new Plot(title : 'Groovy Plot示例', xLabel: 'X轴', yLabel: 'Y轴');
p << new Bars(x: [0, 1, 2, 3, 4, 5], y: [3, 4, 3, 2, 5, 6], width: 0.6)
p << new Line(x: [0, 1, 2, 3, 4, 5], y: [5, 2, 6, 5, 4, 8], width: 3)<jupyter_output><empty_output><jupyter_text>Groovy获取数据，通过autotranslate传递至Python中使用<jupyter_code>from beakerx import *
from beakerx.object import beakerx
%%groovy

// 通过beakerx.xxx进行不同编程语言间的autotranslate。
beakerx.gcsv = new CSV().read("sample.csv")
print(beakerx.gcsv)

Histogram(
    data = [it['单价'] for it in beakerx.gcsv],
    ItemMargin = 1,
    binCount = 10
)
%%groovy

gdata = [
    [ 栏目1: 1, 栏目2: 2],
    [ 栏目1: 3, 栏目2: 4],
    [ 栏目1: 5, 栏目2: 6],
]
gdata << [ 栏目1: 7, 栏目2: 8 ]

beakerx.gdata = gdata
pdata = beakerx.gdata

for it in pdata:
    it['栏目3'] = np.random.randint(1,10) 

TableDisplay(pdata)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1847715736040609, 'fraction_numerical': 0.05685279187817259, 'mean_word_length': 4.417582417582418, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '500339', 'license': 'MIT', 'n_tokens_mistral': 537, 'n_tokens_neox': 500, 'n_words': 106, 'path': 'beakerx_samples/beakerx_python_languagemagic.ipynb', 'repo_name': 'dyslab/jnb-sample', 'size': '985'}