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

Added shift, rolling #644

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from
Open

Added shift, rolling #644

wants to merge 13 commits into from

Conversation

vietlinh007
Copy link

Allow to add or edit column by a number or string
Allow to shift left or right for a Series
Support rolling with sum, mean, max, min, any (any value is True), all (all values is True)
Example:
let data = [[1, 1, 2, 2], [1, 5, 6, 8], [20, 30, 40, 60], [20, 89, 78, 70]];
let cols = ["A", "B", "C", "D"];
let df:any = new dfd.DataFrame(data, { columns: cols });

df.addColumn("E", 5, {inplace: true})
df.print()

df.addColumn("F", df['A'].shift(2), {inplace: true})
df.print()

df.addColumn("K", df['A'].rolling(3).sum(), {inplace: true})
df.print()

let grouped = df.groupby('A').agg({
B: 'last',
C: 'first',
D: 'mean',
E: 'sum'
})
grouped.print()

@vietlinh007 vietlinh007 changed the title add features Added shift, rolling Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant