Closed preritdas closed 1 week ago
The changes involve updates to the CSVStringFormatter
and CSVWithInsightsFormatter
classes in the real_intent/deliver/csv.py
and real_intent/deliver/csv_insights.py
files, respectively. Both classes now include an optional renames
parameter in their constructors, allowing users to specify a dictionary for renaming columns in the output DataFrame. The CSVStringFormatter
class has been modified to include this renaming functionality in its _as_dataframe
method, while the CSVWithInsightsFormatter
class passes the renames
parameter to its superclass.
File Path | Change Summary |
---|---|
real_intent/deliver/csv.py | Updated CSVStringFormatter constructor to include optional renames parameter; modified _as_dataframe to rename columns based on renames . |
real_intent/deliver/csv_insights.py | Updated CSVWithInsightsFormatter constructor to include optional renames parameter; passed renames to superclass constructor. |
tests/test_format.py | Added new test function test_csv_string_formatter_renames to validate renaming functionality in CSVStringFormatter . |
In a field of data bright,
Columns dance in morning light.
With renames now, oh what a sight!
CSVs sing, their names take flight!
A rabbit hops with joy and cheer,
For flexible formats now appear! 🐇✨
Allow base CSV formatter to accept a
renames: dict[str, str] | None = None
and then apply this to_as_dataframe
.Same for insights CSV formatter, but this calls
super()._as_dataframe(...)
so implicitly implemented.Summary by CodeRabbit
New Features
CSVStringFormatter
andCSVWithInsightsFormatter
.Tests
CSVStringFormatter
, ensuring expected behavior and consistency in output.These updates improve the flexibility of CSV exports, allowing users to tailor column names according to their preferences.