Skip to content
Snippets Groups Projects
Commit 5191da26 authored by Stefan Wunsch's avatar Stefan Wunsch
Browse files

[DF] Add output of DescribeDataset on top of Describe

Fixes #7829 finally
parent c5185ecd
No related branches found
No related tags found
No related merge requests found
......@@ -2007,6 +2007,7 @@ public:
/// \return information about the dataframe as string
///
/// This convenience function describes the dataframe and combines the following information:
/// - Information about the dataset, see DescribeDataset()
/// - Number of event loops run, see GetNRuns()
/// - Number of total and defined columns, see GetColumnNames() and GetDefinedColumnNames()
/// - Column names, see GetColumnNames()
......@@ -2030,6 +2031,10 @@ public:
///
std::string Describe()
{
// Put the information from DescribeDataset on the top
std::stringstream ss;
ss << DescribeDataset() << "\n\n";
// Build set of defined column names to find later in all column names
// the defined columns more efficiently
const auto columnNames = GetColumnNames();
......@@ -2050,7 +2055,6 @@ public:
// to the maximum of the string "Value" and all values to be put in this column.
const auto columnWidthValues =
std::max(std::max_element(metadataValues.begin(), metadataValues.end())->size(), static_cast<std::size_t>(5u));
std::stringstream ss;
ss << std::left << std::setw(columnWidthProperties) << "Property" << std::setw(columnWidthValues) << "Value\n"
<< std::setw(columnWidthProperties) << "--------" << std::setw(columnWidthValues) << "-----\n";
......
......@@ -579,7 +579,9 @@ TEST(RDataFrameInterface, Describe)
{
// empty dataframe
RDataFrame df1(1);
const auto ref1 = "Property Value\n"
const auto ref1 = "Empty dataframe filling 1 row\n"
"\n"
"Property Value\n"
"-------- -----\n"
"Columns in total 0\n"
"Columns from defines 0\n"
......@@ -603,7 +605,9 @@ TEST(RDataFrameInterface, Describe)
auto df3 = df2.Define("myVec", "ROOT::RVec<float>({1, 2, 3})")
.Define("myLongColumnName", "1u");
df3.Sum("myInt").GetValue(); // trigger the event loop once
const auto ref2 = "Property Value\n"
const auto ref2 = "Dataframe from TTree tree (in-memory)\n"
"\n"
"Property Value\n"
"-------- -----\n"
"Columns in total 4\n"
"Columns from defines 2\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment