1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "fileUrls": [
12 "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv"
13 ],
14 "filters": [
15 {
16 "field": "species",
17 "op": "in",
18 "value": [
19 "Adelie",
20 "Gentoo"
21 ]
22 },
23 {
24 "field": "body_mass_g",
25 "op": "between",
26 "value": [
27 3500,
28 5000
29 ]
30 },
31 {
32 "field": "sex",
33 "op": "notEmpty"
34 }
35 ],
36 "textCase": {
37 "sex": "lower"
38 },
39 "sortBy": [
40 "body_mass_g desc"
41 ],
42 "renameFields": {
43 "body_mass_g": "bodyMassGrams"
44 }
45};
46
47
48const run = await client.actor("gazidev/dataset-filter-transform").call(input);
49
50
51console.log('Results from dataset');
52console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
53const { items } = await client.dataset(run.defaultDatasetId).listItems();
54items.forEach((item) => {
55 console.dir(item);
56});
57
58