-
Notifications
You must be signed in to change notification settings - Fork 116
Add more examples for the rust #386
Add more examples for the rust #386
Conversation
I started this coz the timeseries example was super hard to do in rust because of the data types, and I somehow found a solution online that was like 10 lines of code for 1 lines in python. But after trying out and cooling off for a day, I was able to find a solution that was as short as the one in the python example. I want to add that, but I wanted to start from the basic ones so that I can learn those as well. So, if you guys don't have anyone else working on these, and want to merge it, then I'll add more to this pull request. |
Just found out the docs fail as the column_selections.rs is incomplete. I thought it'd just keep the rust codes when it finds the blocks and remove it when it can't. If it needs all the blocks in a source files, then we can divide the file into two (I think the selectors part is only applicable to python, I found absolutely no content that looks the same except the ones we normally use in rust already). Or we can also keep empty code blocks just for the docs to run. But if it's fixable from some config (missing block in one language = ignore) then that might be a better idea too. |
2c21240
to
2ab17bd
Compare
Is this ready for review? If so, please mark it as such. I see no reason to remove the Python example here... |
@stinodego I want to add more examples, so I'll mark it ready when I do those, I wanted to make sure it was welcome. And I was not doing something that someone else was already doing. I haven't said anything about removing python examples, considering most people use it in python, that's what most people will want. I was just thinking if the documentation program errors out if the Oh If you mean the edit on |
I've added examples for many chapters on expressions and then for all the chapters in transformations, including the time series subchapter. I saw that some code blocks has I didn't add any examples for following 3 chapters for expressions as they looked a bit complex.
There were a few problems that I couldn't figure out how to solve in a better way. They do work with the examples for now. I just feel like there should be better/easier ways to do them.
|
Ended up adding examples for lists and structs as well. The solutions are sometimes as elegant in rust, but sometimes they are verbose due to the limitations of typed languages. Or maybe there are easier ways that I was not able to find. Anyway, @stinodego it should be done now. If you know ways to make certain examples from here better, please let me know. |
Temporary fix as with the missing blocks the docs refuse to compile and serve. And the selectors are not available in rust: pola-rs/polars#10594
e324b2b
to
4af7ec9
Compare
This is quite an effort! Thanks for the PR @Atreyagaurav We currently do not have a way to validate Rust examples in this repo - will be added later. So I cannot really test all these additions. I'll just merge them for now, we can work out any issues later once validation is added. |
Closes #385
This is just me trying out some of the examples in Rust as they were lacking. I couldn't figure out how to do certain things like in python example as there weren't enough documentation (examples in docs.rs). I'd appreciate comments on things that could be done easily but I took a roundabout method, and other things.