{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Xorbits Pandas DataFrame\n", "\n", "This notebook goes over how to load data from a [xorbits.pandas](https://doc.xorbits.io/en/latest/reference/pandas/frame.html) DataFrame." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "#!pip install xorbits" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import xorbits.pandas as pd" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "df = pd.read_csv(\"example_data/mlb_teams_2012.csv\")" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b0d1d84e23c04f1296f63b3ea3dd1e5b", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0.00/100 [00:00\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Team\"Payroll (millions)\"\"Wins\"
0Nationals81.3498
1Reds82.2097
2Yankees197.9695
3Giants117.6294
4Braves83.3194
\n", "" ], "text/plain": [ " Team \"Payroll (millions)\" \"Wins\"\n", "0 Nationals 81.34 98\n", "1 Reds 82.20 97\n", "2 Yankees 197.96 95\n", "3 Giants 117.62 94\n", "4 Braves 83.31 94" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "from langchain.document_loaders import XorbitsLoader" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "loader = XorbitsLoader(df, page_content_column=\"Team\")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c8c8b67f1aae4a3c9de7734bb6cf738e", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0.00/100 [00:00