Skip to content

Commit

Permalink
few small formatting changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
drizk1 committed Aug 13, 2024
1 parent 67ec490 commit 4c141ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
4 changes: 4 additions & 0 deletions docs/examples/UserGuide/getting_started.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@
# ## data wrangling here
# end
# ```
# ---
# Tip: Setting `t(table) = from_query(table)` will save some keystrokes.
# This means after saving the results of `db_table` you can start all chains/refer to the data with `t(table)``
# ---
22 changes: 15 additions & 7 deletions docs/examples/UserGuide/ibis_comp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# ```
# ## Previewing the data
# TidierDB and Ibis use `head`/`@head` to preview the first rows of a dataset.
# Ibis
# ```python
# mtcars.head(6)
# ```
Expand All @@ -48,7 +49,7 @@
# │ Valiant │ 18.1 │ 6 │ 225.0 │ 105 │ 2.76 │ 3.460 │ 20.22 │ 1 │ 0 │ 3 │ 1 │
# └───────────────────┴─────────┴───────┴─────────┴───────┴─────────┴─────────┴─────────┴───────┴───────┴───────┴───────┘
# ```

# TidierDB
# ```julia
# @chain t(mtcars) @head(6) @collect
# ```
Expand All @@ -67,6 +68,7 @@

# ## Filtering
# The example below demonstrates how to filter using multiple criteria in both Ibis and TidierData
# Ibis
# ```python
# mtcars.filter(((_.mpg > 22) & (_.drat > 4) | (_.hp == 113)))
# ```
Expand Down Expand Up @@ -106,6 +108,7 @@

# ## Creating new columns
# Both TidierDB and Ibis use `mutate`/`@mutate` to add new columns
# Ibis
# ```python
# (
# mtcars
Expand All @@ -132,7 +135,7 @@
# │ … │ … │
# └───────────────────┴─────────┘
# ```
#
# TidierDB
# ```julia
# @chain t(mtcars) begin
# @mutate(kpg = mpg * 1.61)
Expand Down Expand Up @@ -163,6 +166,7 @@

# ## Sorting columns
# Ibis uses `order_by` similar to SQLs `ORDER BY`
# Ibis
# ```python
# mtcars.order_by(_.mpg)
# ```
Expand All @@ -186,6 +190,7 @@
# └─────────────────────┴─────────┴───────┴─────────┴───────┴─────────┴─────────┴─────────┴───────┴───────┴───────┴───────┘
# ```
# While TidierDB uses `@arrange` like TidierData.jl
# TidierDB
# ```
# @chain t(mtcars) @arrange(mpg) @collect
# ```
Expand All @@ -212,6 +217,7 @@

# ## Selecting columns
# In Ibis, columns must be prefixed with the table name, or in this case `_`, or they can be given as a string. Finally to using helper functions like `startswith` requires importing selectors as above.
# Ibis
# ```
# mtcars.select(s.startswith("m"), "drat", _.wt)
# ```
Expand All @@ -234,13 +240,12 @@
# │ … │ … │ … │ … │
# └───────────────────┴─────────┴─────────┴─────────┘
# ```
#
# TidierDB does not require names to be prefixed and, like TidierData, tidy column selection with `starts_with`, `ends_with`, and `contains` is supported at base. TidierDB also supports providing column names as strings, although this would only be needed in the setting of renaming a column with a space in it.
# TidierDB
# ```
# @chain t(mtcars) @select(starts_with("m"), "drat", wt) @collect
# ```
# ```
# 32×2 DataFrame
# 32×4 DataFrame
# Row │ model mpg drat wt
# │ String? Float64? Float64? Float64?
Expand All @@ -262,7 +267,8 @@
# ```

# ## Multi step queries and summarizing
# Aggregating data is done with `aggregate` in ibis and `@summarize` in TidierDB. There is a slight difference in grouping data. Ibis uses `by = ` within the `aggregate` call vs TidierDB adheres to `@group_by` convention
# Aggregating data is done with `aggregate` in Ibis and `@summarize` in TidierDB. To group data, Ibis uses `by = ` within the `aggregate` call vs TidierDB adheres to `@group_by` convention
# Ibis
# ```
# mtcars.aggregate(
# total_hp=_.hp.sum(),
Expand All @@ -281,7 +287,8 @@
# │ 4 │ 909 │ 82.636364 │
# └───────┴──────────┴────────────┘
# ```
# In TidierDB, `@filter` will automatically determine whether the criteria belong in a WHERE or HAVING in SQL clause.
# In TidierDB, `@filter` will automatically determine whether the criteria belong in a `WHERE` or `HAVING` SQL clause.
# TidierDB
# ```
# @chain t(mtcars) begin
# @group_by(cyl)
Expand All @@ -302,6 +309,7 @@

# ## Renaming columns
# Both tools use `rename`/@rename to rename columns
# Ibis
# ```python
# mtcars.rename(make_model = "model").select(_.make_model)
# ```
Expand All @@ -324,7 +332,7 @@
# │ … │
# └───────────────────┘
# ```

# TidierDB
# ```julia
# @chain t(mtcars) @rename(model_make = model) @select(model_make) @collect
# ```
Expand Down

0 comments on commit 4c141ed

Please sign in to comment.