Preinstalled libraries
The managed code-interpreter template includes common Python libraries for data analysis, machine learning, images, audio, and documents. Among them are:
- NumPy, pandas, SciPy, scikit-learn, and xarray;
- Matplotlib, Seaborn, Plotly, and Bokeh;
- Pillow, OpenCV, and scikit-image;
- openpyxl, xlrd, and python-docx;
- NLTK, spaCy, TextBlob, librosa, and soundfile.
You can use them immediately without installing packages at runtime. A pandas DataFrame is also returned as structured data:
mjs
const sandbox = await Sandbox.create("code-interpreter");
try {
const execution = await sandbox.runCode(`
import pandas as pd
sales = pd.DataFrame({
"month": ["January", "February", "March"],
"orders": [18, 24, 31],
})
sales
`);
console.log(execution.results[0].data);
} finally {
await sandbox.kill();
}For another package, either install it in a running sandbox or create a custom Code Interpreter template.