MulaiMulai sekarang secara gratis

CSV document loaders

Comma-separated value (CSV) files are an extremely common file format, particularly in data-related fields. Fortunately, LangChain provides different document loaders for different formats, keeping almost all of the syntax the same!

In this exercise, you'll use a document loader to load a CSV file containing data on FIFA World Cup international viewership. If you're interested in the full analysis behind this data, check out How to Break FIFA.

Latihan ini adalah bagian dari kursus

Developing LLM Applications with LangChain

Lihat Kursus

Petunjuk latihan

  • Import the appropriate class for loading CSV documents in LangChain.
  • Create a document loader for the 'fifa_countries_audience.csv' document, which is available in the current directory.
  • Load the documents into memory to view the contents of the first document.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Import library
from langchain_community.document_loaders.csv_loader import ____

# Create a document loader for fifa_countries_audience.csv
loader = ____

# Load the document
data = ____
print(data[0])
Edit dan Jalankan Kode