Header filtering out of for loop (#5896)

* remove extra print

* dataframe with real index

* corrected dataframe tests

* clippy error

* clippy error

* moved header filter out of loop
This commit is contained in:
Fernando Herrera 2022-06-27 06:33:45 -05:00 committed by GitHub
parent c0901ef707
commit ffbc0b0180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -364,6 +364,13 @@ fn convert_to_table(
headers.insert(0, "#".into());
}
// The header with the INDEX is removed from the table headers since
// it is added to the natural table index
headers = headers
.into_iter()
.filter(|header| header != INDEX_COLUMN_NAME)
.collect();
// Vec of Vec of String1, String2 where String1 is datatype and String2 is value
let mut data: Vec<Vec<(String, String)>> = Vec::new();
@ -389,13 +396,6 @@ fn convert_to_table(
row = vec![("string".to_string(), (row_val).to_string())];
}
// The header with the INDEX is removed from the table headers since
// it is added to the natural table index
headers = headers
.into_iter()
.filter(|header| header != INDEX_COLUMN_NAME)
.collect();
if headers.is_empty() {
row.push((
item.get_type().to_string(),