Skip to content

Commit

Permalink
feat: properties, Expr.list namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Desdaemon committed Jan 13, 2024
1 parent ca38560 commit 5499c57
Show file tree
Hide file tree
Showing 23 changed files with 7,420 additions and 5,968 deletions.
60 changes: 55 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/polars/lib/polars.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export 'src/wrapper/series.dart';
export 'src/extensions.dart';
export 'src/expr.dart';
export 'src/str.dart';
export 'src/list.dart';
export 'src/df.dart';
export 'src/series.dart';

Expand Down
8 changes: 6 additions & 2 deletions packages/polars/lib/src/expr.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:polars/src/str.dart';
import 'str.dart';
import 'list.dart';

import 'wrapper/entry.dart';
import 'wrapper/expr.dart';
Expand Down Expand Up @@ -129,6 +130,7 @@ extension ExprExt on Expr {
Expr std(int ddof) => Expr.agg(AggExpr.std(this, ddof));

StrNamespace get str => StrNamespace(this);
ListNamespace get list => ListNamespace(this);
}

Expr col(String column) => Expr.column(column);
Expand All @@ -142,7 +144,7 @@ Expr lit(Object? value) => value.expr;

/// Begin a chain of [when-then-otherwise](https://docs.pola.rs/user-guide/expressions/functions/#conditionals) expressions.
///
/// ### Example:
/// **Example:**
/// ```dart
/// final data = await df.clone().lazy().select([
/// when(col('a') > 0, then: col('a') * 2)
Expand Down Expand Up @@ -258,6 +260,7 @@ extension DurationPolars on Duration {
}

extension DynamicPolars on dynamic {
@pragma('vm:prefer-inline')
Expr get expr => switch (this) {
int value => value.expr,
double value => value.expr,
Expand All @@ -268,6 +271,7 @@ extension DynamicPolars on dynamic {
Expr expr => expr,
When ternary => ternary.expr,
StrNamespace ns => ns.expr,
ListNamespace ns => ns.expr,
LiteralValue lit => Expr.literal(lit),
null => const Expr.literal(LiteralValue.Null()),
_ => '$this'.expr,
Expand Down
Loading

0 comments on commit 5499c57

Please sign in to comment.