Skip to main content
Glama

frequency_encode

Replaces categories with their frequency (count/total rows). Preserves frequency information for initial exploration or when no target variable exists.

Instructions

Replace each category with its frequency (count / total rows). Quick encoding that preserves frequency information. Useful for initial exploration or when no clear target variable exists. Example: frequency_encode(columns=["City","Category"])

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnsYes
df_nameNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It explains the formula and purpose but does not disclose whether the transformation happens in-place or returns a new dataframe, how missing values are handled, or what the output structure looks like. This is useful but incomplete behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences deliver the core formula, the use case, and an example. Every sentence is purposeful and the most important information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 2-parameter tool with an output schema, the description is mostly complete: it gives the transformation formula, a usage rationale, and an invocation example. The main gap is the unexplained 'df_name' parameter and lack of side-effect details, but overall it provides enough to select and invoke the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. The 'columns' parameter is clarified via the formula and example, but 'df_name' is not mentioned at all, leaving its meaning and default behavior ambiguous.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly identifies the operation ('Replace each category with its frequency (count / total rows)') with a specific resource and effect. It also distinguishes itself from sibling encoding tools by emphasizing frequency preservation and the no-target-variable use case.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use: 'Useful for initial exploration or when no clear target variable exists,' which provides clear context vs alternatives like target_encode. However, it does not name specific alternative tools or give 'when-not-to-use' guidance, so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AstyanM/mcp-data-science'

If you have feedback or need assistance with the MCP directory API, please join our Discord server