MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / _read_csv

Function _read_csv

server/services/batch_parser.py:41–53  ·  view source on GitHub ↗
(content: bytes)

Source from the content-addressed store, hash-verified

39
40
41def _read_csv(content: bytes) -> pd.DataFrame:
42 try:
43 import chardet
44 except Exception:
45 chardet = None
46 encoding = "utf-8"
47 if chardet:
48 detected = chardet.detect(content)
49 encoding = detected.get("encoding") or encoding
50 try:
51 return pd.read_csv(BytesIO(content), encoding=encoding)
52 except Exception as exc:
53 raise ValidationError(f"Failed to read CSV: {exc}", field="file")
54
55
56def _read_excel(content: bytes) -> pd.DataFrame:

Callers 1

parse_batch_fileFunction · 0.85

Calls 2

ValidationErrorClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected