profile tool
Use profile before choosing methods for a data file, as
xpd profile does. It reads the file with pandas in the project's Python and
returns each column's dtype, nulls, distinct values and memory, with findings about how to load
it.
profile(file)- Changes no file
- A second call with the same arguments changes nothing more
- Stays inside the project
Tags: data.
Description
Section titled “Description”The server gives the agent this description of the tool.
Profile a data file (csv, parquet, feather, json or xlsx): each column's dtype, nulls, distinct values and memory. Run it before you choose methods for the data. Needs pandas in the project's Python. Changes no file.
Arguments
Section titled “Arguments”Type: string. Required.
The data file, inside the project root.
Result
Section titled “Result”The columns of a data file as pandas reads it.
The 14 fields of the result
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
file |
string | yes | ||
pandas |
string | yes | The pandas version that read the file. | |
rows |
integer | yes | ||
memory_bytes |
integer | yes | ||
columns |
list of object | yes | ||
columns[].column |
string | yes | ||
columns[].dtype |
string | yes | ||
columns[].nulls |
integer | yes | ||
columns[].unique |
integer or null | yes | Distinct values, or null for unhashable cells. | |
columns[].memory_bytes |
integer | yes | ||
findings |
list of object | no | Column names that hold values, and text columns that suit a category. | |
findings[].finding |
string | yes | values-as-column-names or category-candidate. | |
findings[].columns |
list of string | yes | The columns the finding is about. | |
findings[].message |
string | yes | What was measured on the file, and what to write. |
Example
Section titled “Example”{"file":"samples/data.csv"}{"file":"samples/data.csv","pandas":"3.1.1","rows":3,"memory_bytes":183,"columns":[{"column":"a","dtype":"float64","nulls":1,"unique":2,"memory_bytes":24},{"column":"b","dtype":"str","nulls":0,"unique":2,"memory_bytes":27}],"findings":[]}Errors
Section titled “Errors”A file that cannot be read, or a project Python without pandas, fails with the binary's message.
xpd profile -- samples/missing.csv exited with 2: xpd profile: cannot read samples/missing.csv. [Errno 2] No such file or directory: 'samples/missing.csv'