Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Improve structure of user guide #13639

Merged
merged 12 commits into from
Jan 24, 2024
2 changes: 1 addition & 1 deletion docs/_build/overrides/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ <h2>404 - You're lost.</h2>
How you got here is a mystery. But you can click the button below
to go back to the homepage or use the search bar in the navigation menu to find what you are looking for.
</p>
<a class="md-button" href="/polars">Home</a>
<a class="md-button" href="/user-guide/overview/">Home</a>
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It's the best place to look if you need information on a specific function.
## Python

The Python API reference is built using Sphinx.
It's available on [GitHub Pages](https://docs.pola.rs/py-polars/html/reference/index.html).
It's available in [our docs](https://docs.pola.rs/py-polars/html/reference/index.html).

## Rust

Expand Down
58 changes: 0 additions & 58 deletions docs/index.md

This file was deleted.

23 changes: 10 additions & 13 deletions docs/src/python/user-guide/basics/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@

df = pl.DataFrame(
{
"a": range(8),
"b": np.random.rand(8),
"a": range(5),
"b": np.random.rand(5),
"c": [
datetime(2022, 12, 1),
datetime(2022, 12, 2),
datetime(2022, 12, 3),
datetime(2022, 12, 4),
datetime(2022, 12, 5),
datetime(2022, 12, 6),
datetime(2022, 12, 7),
datetime(2022, 12, 8),
datetime(2025, 12, 1),
datetime(2025, 12, 2),
datetime(2025, 12, 3),
datetime(2025, 12, 4),
datetime(2025, 12, 5),
],
"d": [1, 2.0, float("nan"), float("nan"), 0, -5, -42, None],
"d": [1, 2.0, float("nan"), -42, None],
}
)
# --8<-- [end:setup]
Expand All @@ -36,12 +33,12 @@
# --8<-- [end:select3]

# --8<-- [start:exclude]
df.select(pl.exclude("a"))
df.select(pl.exclude(["a", "c"]))
# --8<-- [end:exclude]

# --8<-- [start:filter]
df.filter(
pl.col("c").is_between(datetime(2022, 12, 2), datetime(2022, 12, 8)),
pl.col("c").is_between(datetime(2025, 12, 2), datetime(2025, 12, 3)),
)
# --8<-- [end:filter]

Expand Down
7 changes: 4 additions & 3 deletions docs/src/python/user-guide/basics/reading-writing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
{
"integer": [1, 2, 3],
"date": [
datetime(2022, 1, 1),
datetime(2022, 1, 2),
datetime(2022, 1, 3),
datetime(2025, 1, 1),
datetime(2025, 1, 2),
datetime(2025, 1, 3),
],
"float": [4.0, 5.0, 6.0],
"string": ["a", "b", "c"]
}
)

Expand Down
25 changes: 11 additions & 14 deletions docs/src/rust/user-guide/basics/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut rng = rand::thread_rng();

let df: DataFrame = df!(
"a" => 0..8,
"b"=> (0..8).map(|_| rng.gen::<f64>()).collect::<Vec<f64>>(),
"a" => 0..5,
"b"=> (0..5).map(|_| rng.gen::<f64>()).collect::<Vec<f64>>(),
"c"=> [
NaiveDate::from_ymd_opt(2022, 12, 1).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2022, 12, 2).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2022, 12, 3).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2022, 12, 4).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2022, 12, 5).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2022, 12, 6).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2022, 12, 7).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2022, 12, 8).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2025, 12, 1).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2025, 12, 2).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2025, 12, 3).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2025, 12, 4).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2025, 12, 5).unwrap().and_hms_opt(0, 0, 0).unwrap(),
],
"d"=> [Some(1.0), Some(2.0), None, None, Some(0.0), Some(-5.0), Some(-42.), None]
"d"=> [Some(1.0), Some(2.0), None, Some(-42.), None]
)
.unwrap();

Expand Down Expand Up @@ -46,17 +43,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let out = df
.clone()
.lazy()
.select([col("*").exclude(["a"])])
.select([col("*").exclude(["a", "c"])])
.collect()?;
println!("{}", out);
// --8<-- [end:exclude]

// --8<-- [start:filter]
let start_date = NaiveDate::from_ymd_opt(2022, 12, 2)
let start_date = NaiveDate::from_ymd_opt(2025, 12, 2)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap();
let end_date = NaiveDate::from_ymd_opt(2022, 12, 8)
let end_date = NaiveDate::from_ymd_opt(2025, 12, 3)
.unwrap()
.and_hms_opt(0, 0, 0)
.unwrap();
Expand Down
6 changes: 3 additions & 3 deletions docs/src/rust/user-guide/basics/reading-writing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut df: DataFrame = df!(
"integer" => &[1, 2, 3],
"date" => &[
NaiveDate::from_ymd_opt(2022, 1, 1).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2022, 1, 2).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2022, 1, 3).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2025, 1, 1).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2025, 1, 2).unwrap().and_hms_opt(0, 0, 0).unwrap(),
NaiveDate::from_ymd_opt(2025, 1, 3).unwrap().and_hms_opt(0, 0, 0).unwrap(),
],
"float" => &[4.0, 5.0, 6.0]
)
Expand Down
130 changes: 0 additions & 130 deletions docs/user-guide/basics/expressions.md

This file was deleted.

18 changes: 0 additions & 18 deletions docs/user-guide/basics/index.md

This file was deleted.

26 changes: 0 additions & 26 deletions docs/user-guide/basics/joins.md

This file was deleted.

Loading
Loading