Closed humphreylee closed 4 weeks ago
Can you provide some examples of how to use this macro?
Some small unit test to check the correct functionality would also be great.
I am not super familiar with macros that's why I am hesitant to merge this. Especially because it was generated by a LLM.
The dz!
macro was developed to address the challenges of constructing ECharts dataframes with dynamic and mixed data types. While reviewing examples, I found examples in the repository typically hardcode all data directly into the chart code. Although the dataframe format is preferred by ECharts, Rust’s type system does not permit mixed data types within a single vector. An example file bubble_scater2.rs
has been added to demonstrate the usage of the dz!
macro with an existing example.
I believed the existing df!
macro could accomplish my goals, but I couldn’t get it to work as intended. I might have overlooked some nuances. Therefore, I developed the dz!
macro.
Added a simple dz_test.rs
unit test file.
Overall this looks good to me, is there any particular meaning of the macro name dz!
?
Overall this looks good to me, is there any particular meaning of the macro name
dz!
?
The naming of dz!
is based on three primary considerations:
dz!
macro constructs a dataframe by interleaving vectors in a zig-zag pattern, iterating row by row across multiple columns/vectors;let df = df()
is frequently encountered in data manipulation libraries such as Rust Polars, R, and Pandas. Personally, I find df
notation can be ambiguous and potentially overused; &df!
is already in use. But dz!
is cool.Thank you very much for the implementation and especially for providing the tests and examples. I am also a big fan of noting down that some of the code was generated using LLM.
The main objective of macro dz! is to transpose mixed data type vectors, aka columns or dimensions into ECharts dataframe format.