execute_pandas_statement: Executes a pandas command string on an R data frame.

View source: R/execute_pandas_statement.R

execute_pandas_statementR Documentation

Executes a pandas command string on an R data frame.

Description

This is the core execution engine. It explicitly injects an R data frame into the Python session, runs a command, retrieves the result, and cleans up.

Usage

execute_pandas_statement(
  r_df,
  py_command,
  table_name = table_name,
  return.as = "result"
)

Arguments

r_df

An R data.frame.

py_command

A character string of Python code using 'df' as a placeholder.

table_name

An optional character string. If provided, the generated Python code will replace the internal dataframe name with this string (e.g., "diamonds.query(...)"). This is useful for seeing the exact, copy-pasteable Python code. Defaults to NULL (uses "df").

return.as

What to return: "result", "code", or "all".

Value

The result of the execution.


rPandas documentation built on April 29, 2026, 1:07 a.m.