From f51ceb8c5b240dcc5008387f7f498fb9399bbed0 Mon Sep 17 00:00:00 2001 From: Rising Odegua Date: Tue, 18 Jan 2022 16:03:55 +0100 Subject: [PATCH 1/8] Update Tensorflow version to 3.13.0 to support M1 chips --- src/danfojs-base/package.json | 4 +- src/danfojs-base/yarn.lock | 325 +++++++++++++++---------------- src/danfojs-browser/package.json | 2 +- src/danfojs-node/package.json | 2 +- src/danfojs-node/yarn.lock | 285 +++++++++++++-------------- 5 files changed, 304 insertions(+), 314 deletions(-) diff --git a/src/danfojs-base/package.json b/src/danfojs-base/package.json index 6afeeece..5b8e6a41 100644 --- a/src/danfojs-base/package.json +++ b/src/danfojs-base/package.json @@ -9,8 +9,8 @@ "author": "", "license": "ISC", "dependencies": { - "@tensorflow/tfjs": "3.6.0", - "@tensorflow/tfjs-node": "3.6.1", + "@tensorflow/tfjs": "^3.13.0", + "@tensorflow/tfjs-node": "^3.13.0", "mathjs": "^10.0.0", "papaparse": "^5.3.1", "request": "^2.88.2", diff --git a/src/danfojs-base/yarn.lock b/src/danfojs-base/yarn.lock index 3922f9a3..31a234ce 100644 --- a/src/danfojs-base/yarn.lock +++ b/src/danfojs-base/yarn.lock @@ -980,6 +980,21 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== +"@mapbox/node-pre-gyp@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.4.tgz#6c76e7a40138eac39e1a4dc869a083e43e236c00" + integrity sha512-M669Qo4nRT7iDmQEjQYC7RU8Z6dpz9UmSbkJ1OFEja3uevCdLKh7IZZki7L1TZj02kRyl82snXFY8QqkyfowrQ== + dependencies: + detect-libc "^1.0.3" + https-proxy-agent "^5.0.0" + make-dir "^3.1.0" + node-fetch "^2.6.1" + nopt "^5.0.0" + npmlog "^4.1.2" + rimraf "^3.0.2" + semver "^7.3.4" + tar "^6.1.0" + "@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3": version "2.1.8-no-fsevents.3" resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b" @@ -1006,80 +1021,82 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@tensorflow/tfjs-backend-cpu@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.6.0.tgz#4e64a7cf1c33b203f71f8f77cd7b0ac1ef25a871" - integrity sha512-ZpAs17hPdKXadbtNjAsymYUILe8V7+pY4fYo8j25nfDTW/HfBpyAwsHPbMcA/n5zyJ7ZJtGKFcCUv1sl24KL1Q== +"@tensorflow/tfjs-backend-cpu@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.13.0.tgz#2a141256fe0a5de0670c31a9ba6990465708dee4" + integrity sha512-POmzUoAP8HooYYTZ72O1ZYkpVZB0f+8PeAkbTxIG0oahcJccj6a0Vovp1A6xWKfljUoPlJb3jWVC++S603ZL8w== dependencies: "@types/seedrandom" "2.4.27" seedrandom "2.4.3" -"@tensorflow/tfjs-backend-webgl@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.6.0.tgz#1ea1a73abea8d6324fd81aedf7f187ab6eb73692" - integrity sha512-zp7l4TmD1khgeSux/Ujaaj8M/v+e8JVIKjOci6HCGaeMNrn74lTSH9oqGPWKUCmpZME17/V0LfRHK34ddmrPSA== +"@tensorflow/tfjs-backend-webgl@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.13.0.tgz#f99df51253de21e20dae195991d332195ab30b4b" + integrity sha512-ZuJS11tCoZx2F1Eq7wqiqu8euJpPW/JV0qOKBehlRpV2qQrR+wHMpBT1hhDl4qU4LdgFTtSggKIRg/L8b0ScUQ== dependencies: - "@tensorflow/tfjs-backend-cpu" "3.6.0" + "@tensorflow/tfjs-backend-cpu" "3.13.0" "@types/offscreencanvas" "~2019.3.0" "@types/seedrandom" "2.4.27" "@types/webgl-ext" "0.0.30" - "@types/webgl2" "0.0.5" + "@types/webgl2" "0.0.6" seedrandom "2.4.3" -"@tensorflow/tfjs-converter@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-3.6.0.tgz#32b3ff31b47e29630a82e30fbe01708facad7fd6" - integrity sha512-9MtatbTSvo3gpEulYI6+byTA3OeXSMT2lzyGAegXO9nMxsvjR01zBvlZ5SmsNyecNh6fMSzdL2+cCdQfQtsIBg== +"@tensorflow/tfjs-converter@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-3.13.0.tgz#3affc86d94c3948b01673a91309a35feb10e5eac" + integrity sha512-H2VpDTv9Ve0HBt7ttzz46DmnsPaiT0B+yJjVH3NebGZbgY9C8boBgJIsdyqfiqEWBS3WxF8h4rh58Hv5XXMgaQ== -"@tensorflow/tfjs-core@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-3.6.0.tgz#6b4d8175790bdff78868eabe6adc6442eb4dc276" - integrity sha512-bb2c3zwK4SgXZRvkTiC7EhCpWbCGp0GMd+1/3Vo2/Z54jiLB/h3sXIgHQrTNiWwhKPtst/xxA+MsslFlvD0A5w== +"@tensorflow/tfjs-core@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-3.13.0.tgz#0cfd707c668250969564991c5c101fb52e51e1aa" + integrity sha512-18qBEVIB/4u2OUK9nA5P1XT3e3LyarElD1UKNSNDpnMLxhLTUVZaCR71eHJcpl9wP2Q0cciaTJCTpJdPv1tNDQ== dependencies: + "@types/long" "^4.0.1" "@types/offscreencanvas" "~2019.3.0" "@types/seedrandom" "2.4.27" "@types/webgl-ext" "0.0.30" + long "4.0.0" node-fetch "~2.6.1" seedrandom "2.4.3" -"@tensorflow/tfjs-data@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-3.6.0.tgz#af2f03cffb75ad8e4c2f46e192e392d9b7f977ed" - integrity sha512-5KU7fnU7cj/opb4aCNDoW4qma64ggDwI0PCs5KEO41T3waVHDLk6bjlFlBVRdjfZqvM0K6EfWEyoiXzdvz/Ieg== +"@tensorflow/tfjs-data@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-3.13.0.tgz#55ae81957b7ed51cb0ce4e82edc63c5b3de152e6" + integrity sha512-n50+lxPK0CU72nlFt4dzMCCNV44CQsQU3sSP9zdR2bYHeoFqjjy1ISp+UV5N5DNLj7bsEMs73kGS1EuJ7YcdqQ== dependencies: "@types/node-fetch" "^2.1.2" node-fetch "~2.6.1" -"@tensorflow/tfjs-layers@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-3.6.0.tgz#5358af559fc8baed304b3e567319fe93f1aa46a6" - integrity sha512-B7EHwAT6KFqhKzdf0e2Sr6haj9qpqpyEATV8OCPHdk+g8z2AGXOLlFfbgW6vCMjy1wb5jzYqCyZDoY3EWdgJAw== +"@tensorflow/tfjs-layers@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-3.13.0.tgz#bc311664eba4f46802ffe3b05bea7df795cae10d" + integrity sha512-kTWJ/+9fbNCMDA9iQjDMYHmWivsiWz8CKNSOZdeCW7tiBwF1EiREBVQXMk1JI11ngQa8f+rYSLs7rkhp3SYl5Q== -"@tensorflow/tfjs-node@3.6.1": - version "3.6.1" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-node/-/tfjs-node-3.6.1.tgz#a1452076fe6da48f5648ca33f85d1127e6881244" - integrity sha512-JA6GE7AYx+zoXiKQmEdMc848HDOurrI3vFyiLk/8bXJDEv7L7oW5y6Q1Ja+Bz5ul7UmOxNG89hyYhfGqJK8qKw== +"@tensorflow/tfjs-node@^3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-node/-/tfjs-node-3.13.0.tgz#cb5270efd171d8893654f7037bc308cba2912ef8" + integrity sha512-LYM3ck/TyipxMFD23moX9qC3F23UBC3zbiw85HTxZ9FPlE1QNLP1UNlfFGeUTnPvY6CUcvPyQsrG9fBTvtwB1A== dependencies: - "@tensorflow/tfjs" "3.6.0" - adm-zip "^0.4.11" + "@mapbox/node-pre-gyp" "1.0.4" + "@tensorflow/tfjs" "3.13.0" + adm-zip "^0.5.2" google-protobuf "^3.9.2" https-proxy-agent "^2.2.1" - node-pre-gyp "0.14.0" progress "^2.0.0" rimraf "^2.6.2" tar "^4.4.6" -"@tensorflow/tfjs@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-3.6.0.tgz#e65956cd40c96523e3f5ec7a58a4bef9ef5e349c" - integrity sha512-uLDMDzyRkJa3fYBeR6etQTFD/t+nkQIH/DznL9hxmYoIYG8PigY2gcrc482TAvsdhiuvxCZ9rl5SyDtP93MvxQ== - dependencies: - "@tensorflow/tfjs-backend-cpu" "3.6.0" - "@tensorflow/tfjs-backend-webgl" "3.6.0" - "@tensorflow/tfjs-converter" "3.6.0" - "@tensorflow/tfjs-core" "3.6.0" - "@tensorflow/tfjs-data" "3.6.0" - "@tensorflow/tfjs-layers" "3.6.0" +"@tensorflow/tfjs@3.13.0", "@tensorflow/tfjs@^3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-3.13.0.tgz#ea0597e0208d403278e2ccbaa5faa479083a04d3" + integrity sha512-B5HvNH+6hHhQQkn+AG+u4j5sxZBMYdsq4IWXlBZzioJcVygtZhBWXkxp01boSwngjqUBgi8S2DopBE7McAUKqQ== + dependencies: + "@tensorflow/tfjs-backend-cpu" "3.13.0" + "@tensorflow/tfjs-backend-webgl" "3.13.0" + "@tensorflow/tfjs-converter" "3.13.0" + "@tensorflow/tfjs-core" "3.13.0" + "@tensorflow/tfjs-data" "3.13.0" + "@tensorflow/tfjs-layers" "3.13.0" argparse "^1.0.10" chalk "^4.1.0" core-js "3" @@ -1132,6 +1149,11 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== +"@types/long@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9" + integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== + "@types/mocha@^8.2.2": version "8.2.3" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.2.3.tgz#bbeb55fbc73f28ea6de601fbfa4613f58d785323" @@ -1228,10 +1250,10 @@ resolved "https://registry.yarnpkg.com/@types/webgl-ext/-/webgl-ext-0.0.30.tgz#0ce498c16a41a23d15289e0b844d945b25f0fb9d" integrity sha512-LKVgNmBxN0BbljJrVUwkxwRYqzsAEPcZOe6S2T6ZaBDIrFp0qu4FNlpc5sM1tGbXUYFgdVQIoeLk1Y1UoblyEg== -"@types/webgl2@0.0.5": - version "0.0.5" - resolved "https://registry.yarnpkg.com/@types/webgl2/-/webgl2-0.0.5.tgz#dd925e20ab8ace80eb4b1e46fda5b109c508fb0d" - integrity sha512-oGaKsBbxQOY5+aJFV3KECDhGaXt+yZJt2y/OZsnQGLRkH6Fvr7rv4pCt3SRH1somIHfej/c4u7NSpCyd9x+1Ow== +"@types/webgl2@0.0.6": + version "0.0.6" + resolved "https://registry.yarnpkg.com/@types/webgl2/-/webgl2-0.0.6.tgz#1ea2db791362bd8521548d664dbd3c5311cdf4b6" + integrity sha512-50GQhDVTq/herLMiqSQkdtRu+d5q/cWHn4VvKJtrj4DJAjo1MNkWYa2MA41BaBO1q1HgsUjuQvEOk0QHvlnAaQ== "@typescript-eslint/eslint-plugin@^4.30.0": version "4.33.0" @@ -1526,16 +1548,23 @@ adler-32@~1.3.0: dependencies: printj "~1.2.2" -adm-zip@^0.4.11: - version "0.4.16" - resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.16.tgz#cf4c508fdffab02c269cbc7f471a875f05570365" - integrity sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg== +adm-zip@^0.5.2: + version "0.5.9" + resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.5.9.tgz#b33691028333821c0cf95c31374c5462f2905a83" + integrity sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg== after@0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" integrity sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8= +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + agent-base@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" @@ -2254,6 +2283,11 @@ chownr@^1.1.4: resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== +chownr@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" + integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== + chrome-trace-event@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" @@ -2641,6 +2675,13 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3: dependencies: ms "2.0.0" +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: + version "4.3.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" + integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== + dependencies: + ms "2.1.2" + debug@4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" @@ -2648,20 +2689,13 @@ debug@4.3.1: dependencies: ms "2.1.2" -debug@^3.1.0, debug@^3.2.6: +debug@^3.1.0: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== dependencies: ms "^2.1.1" -debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: - version "4.3.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" - integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== - dependencies: - ms "2.1.2" - debug@~3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" @@ -2703,11 +2737,6 @@ deep-eql@^3.0.1: dependencies: type-detect "^4.0.0" -deep-extend@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - deep-is@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" @@ -2787,7 +2816,7 @@ des.js@^1.0.0: inherits "^2.0.1" minimalistic-assert "^1.0.0" -detect-libc@^1.0.2: +detect-libc@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= @@ -3535,6 +3564,13 @@ fs-minipass@^1.2.7: dependencies: minipass "^2.6.0" +fs-minipass@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" + integrity sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg== + dependencies: + minipass "^3.0.0" + fs-readdir-recursive@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" @@ -3889,12 +3925,20 @@ https-proxy-agent@^2.2.1: agent-base "^4.3.0" debug "^3.1.0" +https-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" + integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== + dependencies: + agent-base "6" + debug "4" + human-signals@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -iconv-lite@0.4.24, iconv-lite@^0.4.4: +iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -3926,13 +3970,6 @@ ify-loader@^1.1.0: read-package-json "^2.0.2" resolve "^1.1.6" -ignore-walk@^3.0.1: - version "3.0.4" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.4.tgz#c9a09f69b7c7b479a5d74ac1a3c0d4236d2a6335" - integrity sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ== - dependencies: - minimatch "^3.0.4" - ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" @@ -3997,11 +4034,6 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -ini@~1.3.0: - version "1.3.8" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" - integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== - inline-source-map@~0.6.0: version "0.6.2" resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.6.2.tgz#f9393471c18a79d1724f863fa38b586370ade2a5" @@ -4623,6 +4655,11 @@ loglevelnext@^1.0.1: es6-symbol "^3.1.1" object.assign "^4.1.0" +long@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -4810,6 +4847,13 @@ minipass@^2.6.0, minipass@^2.9.0: safe-buffer "^5.1.2" yallist "^3.0.0" +minipass@^3.0.0: + version "3.1.6" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.6.tgz#3b8150aa688a711a1521af5e8779c1d3bb4f45ee" + integrity sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ== + dependencies: + yallist "^4.0.0" + minizlib@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" @@ -4817,6 +4861,14 @@ minizlib@^1.3.3: dependencies: minipass "^2.9.0" +minizlib@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" + integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg== + dependencies: + minipass "^3.0.0" + yallist "^4.0.0" + mixin-deep@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" @@ -4844,6 +4896,11 @@ mkdirp@^0.5.1, mkdirp@^0.5.5: dependencies: minimist "^1.2.5" +mkdirp@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + mocha@^8.3.0: version "8.4.0" resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.4.0.tgz#677be88bf15980a3cae03a73e10a0fc3997f0cff" @@ -4945,15 +5002,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -needle@^2.2.1: - version "2.9.1" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.9.1.tgz#22d1dffbe3490c2b83e301f7709b6736cd8f2684" - integrity sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ== - dependencies: - debug "^3.2.6" - iconv-lite "^0.4.4" - sax "^1.2.4" - negotiator@0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" @@ -4983,22 +5031,6 @@ node-fetch@~2.6.1: dependencies: whatwg-url "^5.0.0" -node-pre-gyp@0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.14.0.tgz#9a0596533b877289bcad4e143982ca3d904ddc83" - integrity sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA== - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.1" - needle "^2.2.1" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4.4.2" - node-preload@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/node-preload/-/node-preload-0.2.1.tgz#c03043bb327f417a18fee7ab7ee57b408a144301" @@ -5011,13 +5043,12 @@ node-releases@^2.0.1: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.1.tgz#3d1d395f204f1f2f29a54358b9fb678765ad2fc5" integrity sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA== -nopt@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" - integrity sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg== +nopt@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88" + integrity sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ== dependencies: abbrev "1" - osenv "^0.1.4" normalize-package-data@^2.0.0: version "2.5.0" @@ -5034,27 +5065,11 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -npm-bundled@^1.0.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.2.tgz#944c78789bd739035b70baa2ca5cc32b8d860bc1" - integrity sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ== - dependencies: - npm-normalize-package-bin "^1.0.1" - -npm-normalize-package-bin@^1.0.0, npm-normalize-package-bin@^1.0.1: +npm-normalize-package-bin@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== -npm-packlist@^1.1.6: - version "1.4.8" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.8.tgz#56ee6cc135b9f98ad3d51c1c95da22bbb9b2ef3e" - integrity sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A== - dependencies: - ignore-walk "^3.0.1" - npm-bundled "^1.0.1" - npm-normalize-package-bin "^1.0.1" - npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" @@ -5062,7 +5077,7 @@ npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" -npmlog@^4.0.2: +npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== @@ -5203,29 +5218,11 @@ os-browserify@~0.3.0: resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= -os-homedir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= - os-shim@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/os-shim/-/os-shim-0.1.3.tgz#6b62c3791cf7909ea35ed46e17658bb417cb3917" integrity sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc= -os-tmpdir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= - -osenv@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" - integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -5558,16 +5555,6 @@ raw-body@2.4.2: iconv-lite "0.4.24" unpipe "1.0.0" -rc@^1.2.7: - version "1.2.8" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - read-only-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-2.0.0.tgz#2724fd6a8113d73764ac288d4386270c1dbf17f0" @@ -5798,7 +5785,7 @@ rfdc@^1.1.4: resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.0.tgz#d0b7c441ab2720d05dc4cf26e01c89631d9da08b" integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA== -rimraf@^2.6.1, rimraf@^2.6.2: +rimraf@^2.6.2: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -5849,11 +5836,6 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sax@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" - integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== - schema-utils@^2.6.5: version "2.7.1" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.1.tgz#1ca4f32d1b24c590c203b8e7a50bf0ea4cd394d7" @@ -5887,7 +5869,7 @@ seedrandom@^3.0.5: resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.5.tgz#54edc85c95222525b0c7a6f6b3543d8e0b3aa0a7" integrity sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg== -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -6380,11 +6362,6 @@ strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1. resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= - subarg@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" @@ -6458,7 +6435,7 @@ tapable@^2.1.1, tapable@^2.2.0: resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== -tar@^4.4.2, tar@^4.4.6: +tar@^4.4.6: version "4.4.19" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3" integrity sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA== @@ -6471,6 +6448,18 @@ tar@^4.4.2, tar@^4.4.6: safe-buffer "^5.2.1" yallist "^3.1.1" +tar@^6.1.0: + version "6.1.11" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" + integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA== + dependencies: + chownr "^2.0.0" + fs-minipass "^2.0.0" + minipass "^3.0.0" + minizlib "^2.1.1" + mkdirp "^1.0.3" + yallist "^4.0.0" + terser-webpack-plugin@^5.1.1: version "5.3.0" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.0.tgz#21641326486ecf91d8054161c816e464435bae9f" diff --git a/src/danfojs-browser/package.json b/src/danfojs-browser/package.json index 3854aa91..4b1ca34e 100644 --- a/src/danfojs-browser/package.json +++ b/src/danfojs-browser/package.json @@ -20,7 +20,7 @@ "dist/" ], "dependencies": { - "@tensorflow/tfjs": "^3.11.0", + "@tensorflow/tfjs": "^3.13.0", "mathjs": "9.4.4", "papaparse": "^5.3.1", "plotly.js-dist-min": "^2.8.0", diff --git a/src/danfojs-node/package.json b/src/danfojs-node/package.json index c9a026a0..7d2ccc2f 100644 --- a/src/danfojs-node/package.json +++ b/src/danfojs-node/package.json @@ -19,7 +19,7 @@ "dist/" ], "dependencies": { - "@tensorflow/tfjs-node": "3.6.1", + "@tensorflow/tfjs-node": "^3.13.0", "mathjs": "^9.4.4", "node-fetch": "^2.6.1", "papaparse": "^5.3.1", diff --git a/src/danfojs-node/yarn.lock b/src/danfojs-node/yarn.lock index f1558dc1..d5dffae8 100644 --- a/src/danfojs-node/yarn.lock +++ b/src/danfojs-node/yarn.lock @@ -890,6 +890,21 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== +"@mapbox/node-pre-gyp@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.4.tgz#6c76e7a40138eac39e1a4dc869a083e43e236c00" + integrity sha512-M669Qo4nRT7iDmQEjQYC7RU8Z6dpz9UmSbkJ1OFEja3uevCdLKh7IZZki7L1TZj02kRyl82snXFY8QqkyfowrQ== + dependencies: + detect-libc "^1.0.3" + https-proxy-agent "^5.0.0" + make-dir "^3.1.0" + node-fetch "^2.6.1" + nopt "^5.0.0" + npmlog "^4.1.2" + rimraf "^3.0.2" + semver "^7.3.4" + tar "^6.1.0" + "@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents": version "2.1.8-no-fsevents" resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.tgz#da7c3996b8e6e19ebd14d82eaced2313e7769f9b" @@ -919,80 +934,82 @@ dependencies: defer-to-connect "^1.0.1" -"@tensorflow/tfjs-backend-cpu@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.6.0.tgz#4e64a7cf1c33b203f71f8f77cd7b0ac1ef25a871" - integrity sha512-ZpAs17hPdKXadbtNjAsymYUILe8V7+pY4fYo8j25nfDTW/HfBpyAwsHPbMcA/n5zyJ7ZJtGKFcCUv1sl24KL1Q== +"@tensorflow/tfjs-backend-cpu@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.13.0.tgz#2a141256fe0a5de0670c31a9ba6990465708dee4" + integrity sha512-POmzUoAP8HooYYTZ72O1ZYkpVZB0f+8PeAkbTxIG0oahcJccj6a0Vovp1A6xWKfljUoPlJb3jWVC++S603ZL8w== dependencies: "@types/seedrandom" "2.4.27" seedrandom "2.4.3" -"@tensorflow/tfjs-backend-webgl@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.6.0.tgz#1ea1a73abea8d6324fd81aedf7f187ab6eb73692" - integrity sha512-zp7l4TmD1khgeSux/Ujaaj8M/v+e8JVIKjOci6HCGaeMNrn74lTSH9oqGPWKUCmpZME17/V0LfRHK34ddmrPSA== +"@tensorflow/tfjs-backend-webgl@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.13.0.tgz#f99df51253de21e20dae195991d332195ab30b4b" + integrity sha512-ZuJS11tCoZx2F1Eq7wqiqu8euJpPW/JV0qOKBehlRpV2qQrR+wHMpBT1hhDl4qU4LdgFTtSggKIRg/L8b0ScUQ== dependencies: - "@tensorflow/tfjs-backend-cpu" "3.6.0" + "@tensorflow/tfjs-backend-cpu" "3.13.0" "@types/offscreencanvas" "~2019.3.0" "@types/seedrandom" "2.4.27" "@types/webgl-ext" "0.0.30" - "@types/webgl2" "0.0.5" + "@types/webgl2" "0.0.6" seedrandom "2.4.3" -"@tensorflow/tfjs-converter@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-3.6.0.tgz#32b3ff31b47e29630a82e30fbe01708facad7fd6" - integrity sha512-9MtatbTSvo3gpEulYI6+byTA3OeXSMT2lzyGAegXO9nMxsvjR01zBvlZ5SmsNyecNh6fMSzdL2+cCdQfQtsIBg== +"@tensorflow/tfjs-converter@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-3.13.0.tgz#3affc86d94c3948b01673a91309a35feb10e5eac" + integrity sha512-H2VpDTv9Ve0HBt7ttzz46DmnsPaiT0B+yJjVH3NebGZbgY9C8boBgJIsdyqfiqEWBS3WxF8h4rh58Hv5XXMgaQ== -"@tensorflow/tfjs-core@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-3.6.0.tgz#6b4d8175790bdff78868eabe6adc6442eb4dc276" - integrity sha512-bb2c3zwK4SgXZRvkTiC7EhCpWbCGp0GMd+1/3Vo2/Z54jiLB/h3sXIgHQrTNiWwhKPtst/xxA+MsslFlvD0A5w== +"@tensorflow/tfjs-core@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-3.13.0.tgz#0cfd707c668250969564991c5c101fb52e51e1aa" + integrity sha512-18qBEVIB/4u2OUK9nA5P1XT3e3LyarElD1UKNSNDpnMLxhLTUVZaCR71eHJcpl9wP2Q0cciaTJCTpJdPv1tNDQ== dependencies: + "@types/long" "^4.0.1" "@types/offscreencanvas" "~2019.3.0" "@types/seedrandom" "2.4.27" "@types/webgl-ext" "0.0.30" + long "4.0.0" node-fetch "~2.6.1" seedrandom "2.4.3" -"@tensorflow/tfjs-data@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-3.6.0.tgz#af2f03cffb75ad8e4c2f46e192e392d9b7f977ed" - integrity sha512-5KU7fnU7cj/opb4aCNDoW4qma64ggDwI0PCs5KEO41T3waVHDLk6bjlFlBVRdjfZqvM0K6EfWEyoiXzdvz/Ieg== +"@tensorflow/tfjs-data@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-3.13.0.tgz#55ae81957b7ed51cb0ce4e82edc63c5b3de152e6" + integrity sha512-n50+lxPK0CU72nlFt4dzMCCNV44CQsQU3sSP9zdR2bYHeoFqjjy1ISp+UV5N5DNLj7bsEMs73kGS1EuJ7YcdqQ== dependencies: "@types/node-fetch" "^2.1.2" node-fetch "~2.6.1" -"@tensorflow/tfjs-layers@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-3.6.0.tgz#5358af559fc8baed304b3e567319fe93f1aa46a6" - integrity sha512-B7EHwAT6KFqhKzdf0e2Sr6haj9qpqpyEATV8OCPHdk+g8z2AGXOLlFfbgW6vCMjy1wb5jzYqCyZDoY3EWdgJAw== +"@tensorflow/tfjs-layers@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-3.13.0.tgz#bc311664eba4f46802ffe3b05bea7df795cae10d" + integrity sha512-kTWJ/+9fbNCMDA9iQjDMYHmWivsiWz8CKNSOZdeCW7tiBwF1EiREBVQXMk1JI11ngQa8f+rYSLs7rkhp3SYl5Q== -"@tensorflow/tfjs-node@3.6.1": - version "3.6.1" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-node/-/tfjs-node-3.6.1.tgz#a1452076fe6da48f5648ca33f85d1127e6881244" - integrity sha512-JA6GE7AYx+zoXiKQmEdMc848HDOurrI3vFyiLk/8bXJDEv7L7oW5y6Q1Ja+Bz5ul7UmOxNG89hyYhfGqJK8qKw== +"@tensorflow/tfjs-node@^3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-node/-/tfjs-node-3.13.0.tgz#cb5270efd171d8893654f7037bc308cba2912ef8" + integrity sha512-LYM3ck/TyipxMFD23moX9qC3F23UBC3zbiw85HTxZ9FPlE1QNLP1UNlfFGeUTnPvY6CUcvPyQsrG9fBTvtwB1A== dependencies: - "@tensorflow/tfjs" "3.6.0" - adm-zip "^0.4.11" + "@mapbox/node-pre-gyp" "1.0.4" + "@tensorflow/tfjs" "3.13.0" + adm-zip "^0.5.2" google-protobuf "^3.9.2" https-proxy-agent "^2.2.1" - node-pre-gyp "0.14.0" progress "^2.0.0" rimraf "^2.6.2" tar "^4.4.6" -"@tensorflow/tfjs@3.6.0": - version "3.6.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-3.6.0.tgz#e65956cd40c96523e3f5ec7a58a4bef9ef5e349c" - integrity sha512-uLDMDzyRkJa3fYBeR6etQTFD/t+nkQIH/DznL9hxmYoIYG8PigY2gcrc482TAvsdhiuvxCZ9rl5SyDtP93MvxQ== - dependencies: - "@tensorflow/tfjs-backend-cpu" "3.6.0" - "@tensorflow/tfjs-backend-webgl" "3.6.0" - "@tensorflow/tfjs-converter" "3.6.0" - "@tensorflow/tfjs-core" "3.6.0" - "@tensorflow/tfjs-data" "3.6.0" - "@tensorflow/tfjs-layers" "3.6.0" +"@tensorflow/tfjs@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-3.13.0.tgz#ea0597e0208d403278e2ccbaa5faa479083a04d3" + integrity sha512-B5HvNH+6hHhQQkn+AG+u4j5sxZBMYdsq4IWXlBZzioJcVygtZhBWXkxp01boSwngjqUBgi8S2DopBE7McAUKqQ== + dependencies: + "@tensorflow/tfjs-backend-cpu" "3.13.0" + "@tensorflow/tfjs-backend-webgl" "3.13.0" + "@tensorflow/tfjs-converter" "3.13.0" + "@tensorflow/tfjs-core" "3.13.0" + "@tensorflow/tfjs-data" "3.13.0" + "@tensorflow/tfjs-layers" "3.13.0" argparse "^1.0.10" chalk "^4.1.0" core-js "3" @@ -1034,6 +1051,11 @@ resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.19.tgz#80f286b515897413c7a35bdda069cc80f2344233" integrity sha512-jRJgpRBuY+7izT7/WNXP/LsMO9YonsstuL+xuvycDyESpoDoIAsMd7suwpB4h9oEWB+ZlPTqJJ8EHomzNhwTPQ== +"@types/long@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9" + integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== + "@types/mocha@^9.0.0": version "9.0.0" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.0.0.tgz#3205bcd15ada9bc681ac20bef64e9e6df88fd297" @@ -1116,10 +1138,10 @@ resolved "https://registry.yarnpkg.com/@types/webgl-ext/-/webgl-ext-0.0.30.tgz#0ce498c16a41a23d15289e0b844d945b25f0fb9d" integrity sha512-LKVgNmBxN0BbljJrVUwkxwRYqzsAEPcZOe6S2T6ZaBDIrFp0qu4FNlpc5sM1tGbXUYFgdVQIoeLk1Y1UoblyEg== -"@types/webgl2@0.0.5": - version "0.0.5" - resolved "https://registry.yarnpkg.com/@types/webgl2/-/webgl2-0.0.5.tgz#dd925e20ab8ace80eb4b1e46fda5b109c508fb0d" - integrity sha512-oGaKsBbxQOY5+aJFV3KECDhGaXt+yZJt2y/OZsnQGLRkH6Fvr7rv4pCt3SRH1somIHfej/c4u7NSpCyd9x+1Ow== +"@types/webgl2@0.0.6": + version "0.0.6" + resolved "https://registry.yarnpkg.com/@types/webgl2/-/webgl2-0.0.6.tgz#1ea2db791362bd8521548d664dbd3c5311cdf4b6" + integrity sha512-50GQhDVTq/herLMiqSQkdtRu+d5q/cWHn4VvKJtrj4DJAjo1MNkWYa2MA41BaBO1q1HgsUjuQvEOk0QHvlnAaQ== abab@^2.0.3, abab@^2.0.5: version "2.0.5" @@ -1174,10 +1196,10 @@ adler-32@~1.3.0: dependencies: printj "~1.2.2" -adm-zip@^0.4.11: - version "0.4.16" - resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.16.tgz#cf4c508fdffab02c269cbc7f471a875f05570365" - integrity sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg== +adm-zip@^0.5.2: + version "0.5.9" + resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.5.9.tgz#b33691028333821c0cf95c31374c5462f2905a83" + integrity sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg== agent-base@6: version "6.0.2" @@ -1695,6 +1717,11 @@ chownr@^1.1.1: resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== +chownr@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" + integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== + ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -2086,7 +2113,7 @@ delegates@^1.0.0: resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= -detect-libc@^1.0.2: +detect-libc@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= @@ -2599,6 +2626,13 @@ fs-minipass@^1.2.5: dependencies: minipass "^2.6.0" +fs-minipass@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" + integrity sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg== + dependencies: + minipass "^3.0.0" + fs-readdir-recursive@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" @@ -2945,7 +2979,7 @@ https-proxy-agent@^5.0.0: agent-base "6" debug "4" -iconv-lite@0.4.24, iconv-lite@^0.4.4: +iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -2957,13 +2991,6 @@ ignore-by-default@^1.0.1: resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" integrity sha1-SMptcvbGo68Aqa1K5odr44ieKwk= -ignore-walk@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" - integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== - dependencies: - minimatch "^3.0.4" - ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" @@ -3556,6 +3583,11 @@ log-symbols@3.0.0: dependencies: chalk "^2.4.2" +long@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" @@ -3581,7 +3613,7 @@ make-dir@^2.0.0, make-dir@^2.1.0: pify "^4.0.1" semver "^5.6.0" -make-dir@^3.0.0, make-dir@^3.0.2: +make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== @@ -3676,6 +3708,13 @@ minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: safe-buffer "^5.1.2" yallist "^3.0.0" +minipass@^3.0.0: + version "3.1.6" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.6.tgz#3b8150aa688a711a1521af5e8779c1d3bb4f45ee" + integrity sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ== + dependencies: + yallist "^4.0.0" + minizlib@^1.2.1: version "1.3.3" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" @@ -3683,6 +3722,14 @@ minizlib@^1.2.1: dependencies: minipass "^2.9.0" +minizlib@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" + integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg== + dependencies: + minipass "^3.0.0" + yallist "^4.0.0" + mixin-deep@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" @@ -3691,13 +3738,18 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.5.5, mkdirp@^0.5.0, mkdirp@^0.5.1: +mkdirp@0.5.5, mkdirp@^0.5.0: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== dependencies: minimist "^1.2.5" +mkdirp@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + mocha@^7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/mocha/-/mocha-7.2.0.tgz#01cc227b00d875ab1eed03a75106689cfed5a604" @@ -3770,15 +3822,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -needle@^2.2.1: - version "2.6.0" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.6.0.tgz#24dbb55f2509e2324b4a99d61f413982013ccdbe" - integrity sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg== - dependencies: - debug "^3.2.6" - iconv-lite "^0.4.4" - sax "^1.2.4" - node-environment-flags@1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.6.tgz#a30ac13621f6f7d674260a54dede048c3982c088" @@ -3797,22 +3840,6 @@ node-modules-regexp@^1.0.0: resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= -node-pre-gyp@0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.14.0.tgz#9a0596533b877289bcad4e143982ca3d904ddc83" - integrity sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA== - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.1" - needle "^2.2.1" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4.4.2" - node-preload@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/node-preload/-/node-preload-0.2.1.tgz#c03043bb327f417a18fee7ab7ee57b408a144301" @@ -3841,13 +3868,12 @@ nodemon@^2.0.7: undefsafe "^2.0.3" update-notifier "^4.1.0" -nopt@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" - integrity sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg== +nopt@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88" + integrity sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ== dependencies: abbrev "1" - osenv "^0.1.4" nopt@~1.0.10: version "1.0.10" @@ -3873,28 +3899,7 @@ normalize-url@^4.1.0: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.1.tgz#0dd90cf1288ee1d1313b87081c9a5932ee48518a" integrity sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA== -npm-bundled@^1.0.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" - integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== - dependencies: - npm-normalize-package-bin "^1.0.1" - -npm-normalize-package-bin@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" - integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== - -npm-packlist@^1.1.6: - version "1.4.8" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.8.tgz#56ee6cc135b9f98ad3d51c1c95da22bbb9b2ef3e" - integrity sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A== - dependencies: - ignore-walk "^3.0.1" - npm-bundled "^1.0.1" - npm-normalize-package-bin "^1.0.1" - -npmlog@^4.0.2: +npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== @@ -4050,24 +4055,6 @@ optionator@^0.9.1: type-check "^0.4.0" word-wrap "^1.2.3" -os-homedir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= - -os-tmpdir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= - -osenv@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" - integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - p-cancelable@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-1.1.0.tgz#d078d15a3af409220c886f1d9a0ca2e441ab26cc" @@ -4306,7 +4293,7 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -rc@^1.2.7, rc@^1.2.8: +rc@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== @@ -4524,7 +4511,7 @@ ret@~0.1.10: resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -rimraf@^2.6.1, rimraf@^2.6.2: +rimraf@^2.6.2: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== @@ -4560,11 +4547,6 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sax@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" - integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== - saxes@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" @@ -4599,7 +4581,7 @@ semver@7.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== -semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1: +semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -4616,6 +4598,13 @@ semver@^7.2.1: dependencies: lru-cache "^6.0.0" +semver@^7.3.4: + version "7.3.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" + integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== + dependencies: + lru-cache "^6.0.0" + set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -4950,7 +4939,7 @@ table@^6.0.4: slice-ansi "^4.0.0" string-width "^4.2.0" -tar@^4.4.2, tar@^4.4.6: +tar@^4.4.6: version "4.4.13" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== @@ -4963,6 +4952,18 @@ tar@^4.4.2, tar@^4.4.6: safe-buffer "^5.1.2" yallist "^3.0.3" +tar@^6.1.0: + version "6.1.11" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" + integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA== + dependencies: + chownr "^2.0.0" + fs-minipass "^2.0.0" + minipass "^3.0.0" + minizlib "^2.1.1" + mkdirp "^1.0.3" + yallist "^4.0.0" + term-size@^2.1.0: version "2.2.1" resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.2.1.tgz#2a6a54840432c2fb6320fea0f415531e90189f54" From 987809ad2fe4422b99327ecd44bc671f9678d0d1 Mon Sep 17 00:00:00 2001 From: Rising Odegua Date: Tue, 18 Jan 2022 16:04:16 +0100 Subject: [PATCH 2/8] Add date method to datetime --- src/danfojs-base/core/datetime.ts | 60 ++++++++++----- src/danfojs-base/shared/types.ts | 1 + .../tests/core/datetime.test.js | 13 ++++ src/danfojs-browser/yarn.lock | 74 +++++++++---------- src/danfojs-node/test/core/datetime.test.ts | 20 +++++ 5 files changed, 112 insertions(+), 56 deletions(-) diff --git a/src/danfojs-base/core/datetime.ts b/src/danfojs-base/core/datetime.ts index 264f0e10..accbc7f3 100644 --- a/src/danfojs-base/core/datetime.ts +++ b/src/danfojs-base/core/datetime.ts @@ -46,14 +46,14 @@ export default class TimeSeries implements DateTime { * Returns the month, in local time. * @example * ``` - * import { Dataframe } from "danfojs-node" + * import { Series } from "danfojs-node" * const data = [ * "2019-01-01", * "2019-02-01", * "2019-03-01", * "2019-04-01", * ] - * const df = new Dataframe(data) + * const df = new Series(data) * const dfNew = df.dt.month() * console.log(dfNew.values) * // [1, 2, 3, 4] @@ -68,19 +68,19 @@ export default class TimeSeries implements DateTime { * Returns the day of the week, in local time * @example * ``` - * import { Dataframe } from "danfojs-node" + * import { Series } from "danfojs-node" * const data = [ * "2019-01-01", * "2019-02-01", * "2019-03-01", * "2019-04-01", * ] - * const df = new Dataframe(data) + * const df = new Series(data) * const dayOfWeek = df.dt.dayOfWeek() * console.log(dayOfWeek.values) * ``` */ - dayOfWeek() { + dayOfWeek() { const newValues = this.$dateObjectArray.map(date => date.getDay()) return new Series(newValues); } @@ -89,14 +89,14 @@ export default class TimeSeries implements DateTime { * Returns the year, in local time * @example * ``` - * import { Dataframe } from "danfojs-node" + * import { Series } from "danfojs-node" * const data = [ * "2019-01-01", * "2019-02-01", * "2021-03-01", * "2020-04-01", * ] - * const df = new Dataframe(data) + * const df = new Series(data) * const year = df.dt.year() * console.log(year.values) * // [2019, 2019, 2021, 2020] @@ -111,14 +111,14 @@ export default class TimeSeries implements DateTime { * Returns the name of the month, in local time * @example * ``` - * import { Dataframe } from "danfojs-node" + * import { Series } from "danfojs-node" * const data = [ * "2019-01-01", * "2019-02-01", * "2021-03-01", * "2020-04-01", * ] - * const df = new Dataframe(data) + * const df = new Series(data) * const monthName = df.dt.monthName().values * console.log(monthName) * // ["January", "February", "March", "April"] @@ -133,14 +133,14 @@ export default class TimeSeries implements DateTime { * Returns the name of the day, of the week, in local time * @example * ``` - * import { Dataframe } from "danfojs-node" + * import { Series } from "danfojs-node" * const data = [ * "2019-01-01", * "2019-02-01", * "2021-03-01", * "2020-04-01", * ] - * const df = new Dataframe(data) + * const df = new Series(data) * const dayOfWeekName = df.dt.dayOfWeekName().values * console.log(dayOfWeekName) * ``` @@ -154,14 +154,14 @@ export default class TimeSeries implements DateTime { * Returns the day of the month, in local time * @example * ``` - * import { Dataframe } from "danfojs-node" + * import { Series } from "danfojs-node" * const data = [ * "2019-01-01", * "2019-02-05", * "2021-03-02", * "2020-04-01", * ] - * const df = new Dataframe(data) + * const df = new Series(data) * const dayOfMonth = df.dt.dayOfMonth().values * console.log(dayOfMonth) * // [1, 5, 2, 1] @@ -176,14 +176,14 @@ export default class TimeSeries implements DateTime { * Returns the hour of the day, in local time * @example * ``` - * import { Dataframe } from "danfojs-node" + * import { Series } from "danfojs-node" * const data = [ * "2019-01-01", * "2019-02-05", * "2021-03-02", * "2020-04-01", * ] - * const df = new Dataframe(data) + * const df = new Series(data) * const hour = df.dt.hour().values * console.log(hour) * // [0, 0, 0, 0] @@ -198,14 +198,14 @@ export default class TimeSeries implements DateTime { * Returns the second of the day, in local time * @example * ``` - * import { Dataframe } from "danfojs-node" + * import { Series } from "danfojs-node" * const data = [ * "2019-01-01", * "2019-02-05", * "2021-03-02", * "2020-04-01", * ] - * const df = new Dataframe(data) + * const df = new Series(data) * const second = df.dt.second().values * console.log(second) * ``` @@ -219,14 +219,14 @@ export default class TimeSeries implements DateTime { * Returns the minute of the day, in local time * @example * ``` - * import { Dataframe } from "danfojs-node" + * import { Series } from "danfojs-node" * const data = [ * "2019-01-01", * "2019-02-05", * "2021-03-02", * "2020-04-01", * ] - * const df = new Dataframe(data) + * const df = new Series(data) * const minute = df.dt.minute().values * console.log(minute) * ``` @@ -236,6 +236,28 @@ export default class TimeSeries implements DateTime { return new Series(newValues); } + /** + * Returns the Date as JavaScript standard Date object + * @example + * ``` + * import { Series } from "danfojs-node" + * const data = [ + * "2019-01-01", + * "2019-02-05", + * "2021-03-02", + * "2020-04-01", + * ] + * + * const df = new Series(data) + * const date = df.dt.toDate().values + * console.log(date) + * ``` + */ + date() { + const newValues = this.$dateObjectArray.map(date => date.toLocaleString()) + return new Series(newValues); + } + } export const toDateTime = (data: Series | ArrayType1D) => { diff --git a/src/danfojs-base/shared/types.ts b/src/danfojs-base/shared/types.ts index 3c3e23fc..60f30b55 100644 --- a/src/danfojs-base/shared/types.ts +++ b/src/danfojs-base/shared/types.ts @@ -338,6 +338,7 @@ export interface DateTime { hours(): Series seconds(): Series minutes(): Series + date(): Series } interface CustomConfig extends Config { diff --git a/src/danfojs-browser/tests/core/datetime.test.js b/src/danfojs-browser/tests/core/datetime.test.js index 1562e743..6bd7fdef 100644 --- a/src/danfojs-browser/tests/core/datetime.test.js +++ b/src/danfojs-browser/tests/core/datetime.test.js @@ -88,4 +88,17 @@ describe("TimeSeries", function () { assert.deepEqual(dateTime.monthName().values, expectedMonthName); }); + + it("Returns date string in standard JS format", function () { + const data = [ "02Sep2019", "03Aug2019", "04July2019" ]; + const dateTime = dfd.toDateTime(data); + const expected = [ "2019-09-02", "2019-08-03", "2019-07-04" ]; + + const data2 = new Series([ "12.30.19", "12.22.19", "11.01.20" ]); + const dateTime2 = dfd.toDateTime(data2); + const expected2 = [ "2019-12-30", "2019-12-22", "2020-11-01" ]; + + assert.deepEqual(dateTime.date().values, expected); + assert.deepEqual(dateTime2.date().values, expected2); + }); }); diff --git a/src/danfojs-browser/yarn.lock b/src/danfojs-browser/yarn.lock index bf857024..a8b31198 100644 --- a/src/danfojs-browser/yarn.lock +++ b/src/danfojs-browser/yarn.lock @@ -922,35 +922,35 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@tensorflow/tfjs-backend-cpu@3.11.0": - version "3.11.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.11.0.tgz#01d5d68b91faf12bee4854adae56bc956b794f1a" - integrity sha512-ShLkrZ4/rmhZwzGKenMFDfQnaEbyZgWA5F8JRa52Iob/vptlZeuOzjq87CZKmZMUmDswR9A2kjzovT/H1bJdWQ== +"@tensorflow/tfjs-backend-cpu@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-3.13.0.tgz#2a141256fe0a5de0670c31a9ba6990465708dee4" + integrity sha512-POmzUoAP8HooYYTZ72O1ZYkpVZB0f+8PeAkbTxIG0oahcJccj6a0Vovp1A6xWKfljUoPlJb3jWVC++S603ZL8w== dependencies: "@types/seedrandom" "2.4.27" seedrandom "2.4.3" -"@tensorflow/tfjs-backend-webgl@3.11.0": - version "3.11.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.11.0.tgz#fbd7f24c164d17c11d964206b4b075b073b1a3bc" - integrity sha512-rNnc/dZ7LIl9O/Pn9W24I1h8kgpJ+XvG8NrdNSfIoWPCW4fvPSlU7B3yMeZXvRneny+z+T3xRs96nWyU2mZBJw== +"@tensorflow/tfjs-backend-webgl@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-3.13.0.tgz#f99df51253de21e20dae195991d332195ab30b4b" + integrity sha512-ZuJS11tCoZx2F1Eq7wqiqu8euJpPW/JV0qOKBehlRpV2qQrR+wHMpBT1hhDl4qU4LdgFTtSggKIRg/L8b0ScUQ== dependencies: - "@tensorflow/tfjs-backend-cpu" "3.11.0" + "@tensorflow/tfjs-backend-cpu" "3.13.0" "@types/offscreencanvas" "~2019.3.0" "@types/seedrandom" "2.4.27" "@types/webgl-ext" "0.0.30" "@types/webgl2" "0.0.6" seedrandom "2.4.3" -"@tensorflow/tfjs-converter@3.11.0": - version "3.11.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-3.11.0.tgz#0842269a83599b52fd167a8a05372018a9a1ca6a" - integrity sha512-rTRIKvBoqL0qdPYpm8UXauZycOiaBHZB2E2v3OoXoHnjvle/Xn/09uZJdrixgGhR+Kahs3Vz27BEEFz6RI5j2w== +"@tensorflow/tfjs-converter@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-3.13.0.tgz#3affc86d94c3948b01673a91309a35feb10e5eac" + integrity sha512-H2VpDTv9Ve0HBt7ttzz46DmnsPaiT0B+yJjVH3NebGZbgY9C8boBgJIsdyqfiqEWBS3WxF8h4rh58Hv5XXMgaQ== -"@tensorflow/tfjs-core@3.11.0": - version "3.11.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-3.11.0.tgz#1e3986533faaed922bbfc2fe86da506d0e9e5c79" - integrity sha512-JOp+1+LCd0Xg3hu7fu6iQPWZnN8Hc6ssfP7B+625XH5GYY1/OhVASa7Ahe2mJr9gZovY2lw8FUejLh1jMmBb1Q== +"@tensorflow/tfjs-core@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-3.13.0.tgz#0cfd707c668250969564991c5c101fb52e51e1aa" + integrity sha512-18qBEVIB/4u2OUK9nA5P1XT3e3LyarElD1UKNSNDpnMLxhLTUVZaCR71eHJcpl9wP2Q0cciaTJCTpJdPv1tNDQ== dependencies: "@types/long" "^4.0.1" "@types/offscreencanvas" "~2019.3.0" @@ -960,30 +960,30 @@ node-fetch "~2.6.1" seedrandom "2.4.3" -"@tensorflow/tfjs-data@3.11.0": - version "3.11.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-3.11.0.tgz#90dd23a7181f0a744f2882a12c3442b27047383d" - integrity sha512-+cUHUHzjM/zs0JVOwHQm9wP15Y+BZdRcUpMoYWia8r3kaGSyvoz6WqzacEP1PeXgJVnr2gtU3D+bF32th8fZfQ== +"@tensorflow/tfjs-data@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-3.13.0.tgz#55ae81957b7ed51cb0ce4e82edc63c5b3de152e6" + integrity sha512-n50+lxPK0CU72nlFt4dzMCCNV44CQsQU3sSP9zdR2bYHeoFqjjy1ISp+UV5N5DNLj7bsEMs73kGS1EuJ7YcdqQ== dependencies: "@types/node-fetch" "^2.1.2" node-fetch "~2.6.1" -"@tensorflow/tfjs-layers@3.11.0": - version "3.11.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-3.11.0.tgz#456d8dc3fe93937ced329d5d06310da294d3758c" - integrity sha512-BtLgLucJZHv5te1K3yjT3iZdHXgMJArrLuOb/oRPOtTp4R2ad5N0V2m5RtuZJ3sI5/ah0h72xtmTWNyTv3/5dw== - -"@tensorflow/tfjs@^3.11.0": - version "3.11.0" - resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-3.11.0.tgz#63d5231f41d57ca11b910664632a8e349eba3967" - integrity sha512-TTYrKdkoh1sHnt4vn6MboLbpi1Es4U1Aw+L3PqwadRvXW4+7ySUtc00McrQ+ooK0q3Qhl3N7cvgchgM7nED3Mg== - dependencies: - "@tensorflow/tfjs-backend-cpu" "3.11.0" - "@tensorflow/tfjs-backend-webgl" "3.11.0" - "@tensorflow/tfjs-converter" "3.11.0" - "@tensorflow/tfjs-core" "3.11.0" - "@tensorflow/tfjs-data" "3.11.0" - "@tensorflow/tfjs-layers" "3.11.0" +"@tensorflow/tfjs-layers@3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-3.13.0.tgz#bc311664eba4f46802ffe3b05bea7df795cae10d" + integrity sha512-kTWJ/+9fbNCMDA9iQjDMYHmWivsiWz8CKNSOZdeCW7tiBwF1EiREBVQXMk1JI11ngQa8f+rYSLs7rkhp3SYl5Q== + +"@tensorflow/tfjs@^3.13.0": + version "3.13.0" + resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-3.13.0.tgz#ea0597e0208d403278e2ccbaa5faa479083a04d3" + integrity sha512-B5HvNH+6hHhQQkn+AG+u4j5sxZBMYdsq4IWXlBZzioJcVygtZhBWXkxp01boSwngjqUBgi8S2DopBE7McAUKqQ== + dependencies: + "@tensorflow/tfjs-backend-cpu" "3.13.0" + "@tensorflow/tfjs-backend-webgl" "3.13.0" + "@tensorflow/tfjs-converter" "3.13.0" + "@tensorflow/tfjs-core" "3.13.0" + "@tensorflow/tfjs-data" "3.13.0" + "@tensorflow/tfjs-layers" "3.13.0" argparse "^1.0.10" chalk "^4.1.0" core-js "3" diff --git a/src/danfojs-node/test/core/datetime.test.ts b/src/danfojs-node/test/core/datetime.test.ts index 94d0c122..2a2e5683 100644 --- a/src/danfojs-node/test/core/datetime.test.ts +++ b/src/danfojs-node/test/core/datetime.test.ts @@ -91,4 +91,24 @@ describe("TimeSeries", function () { assert.deepEqual(dateTime.monthName().values, expectedMonthName); }); + + it("Returns date string in standard JS format", function () { + const data = ["02Sep2019", "03Aug2019", "04July2019"]; + const dateTime = toDateTime(data); + const expected = [ + '9/2/2019, 12:00:00 AM', + '8/3/2019, 12:00:00 AM', + '7/4/2019, 12:00:00 AM' + ] + + const data2 = new Series(["12.30.19", "12.22.19", "11.01.20"]); + const dateTime2 = toDateTime(data2); + const expected2 = [ + '12/30/2019, 12:00:00 AM', + '12/22/2019, 12:00:00 AM', + '11/1/2020, 12:00:00 AM' + ] + assert.deepEqual(dateTime.date().values, expected); + assert.deepEqual(dateTime2.date().values, expected2); + }); }); From a5d6a429db8ba7830dfe0f16a412a5d4a0638a19 Mon Sep 17 00:00:00 2001 From: Rising Odegua Date: Wed, 19 Jan 2022 11:12:10 +0100 Subject: [PATCH 3/8] Updated Datatime test --- src/danfojs-browser/tests/core/datetime.test.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/danfojs-browser/tests/core/datetime.test.js b/src/danfojs-browser/tests/core/datetime.test.js index 6bd7fdef..e89bb97d 100644 --- a/src/danfojs-browser/tests/core/datetime.test.js +++ b/src/danfojs-browser/tests/core/datetime.test.js @@ -92,12 +92,19 @@ describe("TimeSeries", function () { it("Returns date string in standard JS format", function () { const data = [ "02Sep2019", "03Aug2019", "04July2019" ]; const dateTime = dfd.toDateTime(data); - const expected = [ "2019-09-02", "2019-08-03", "2019-07-04" ]; + const expected = [ + '9/2/2019, 12:00:00 AM', + '8/3/2019, 12:00:00 AM', + '7/4/2019, 12:00:00 AM' + ]; - const data2 = new Series([ "12.30.19", "12.22.19", "11.01.20" ]); + const data2 = new dfd.Series([ "12.30.19", "12.22.19", "11.01.20" ]); const dateTime2 = dfd.toDateTime(data2); - const expected2 = [ "2019-12-30", "2019-12-22", "2020-11-01" ]; - + const expected2 = [ + '12/30/2019, 12:00:00 AM', + '12/22/2019, 12:00:00 AM', + '11/1/2020, 12:00:00 AM' + ]; assert.deepEqual(dateTime.date().values, expected); assert.deepEqual(dateTime2.date().values, expected2); }); From c11944298781f893cf6d5168af80000ee8333432 Mon Sep 17 00:00:00 2001 From: Rising Odegua Date: Wed, 19 Jan 2022 12:22:24 +0100 Subject: [PATCH 4/8] Add iat and at methods to DataFrame --- src/danfojs-base/core/frame.ts | 49 ++++++++- src/danfojs-base/shared/types.ts | 2 + src/danfojs-browser/tests/core/frame.test.js | 108 ++++++++----------- src/danfojs-node/test/core/frame.test.ts | 47 ++++++++ 4 files changed, 141 insertions(+), 65 deletions(-) diff --git a/src/danfojs-base/core/frame.ts b/src/danfojs-base/core/frame.ts index b9e575c4..0abaa457 100644 --- a/src/danfojs-base/core/frame.ts +++ b/src/danfojs-base/core/frame.ts @@ -1747,8 +1747,8 @@ export default class DataFrame extends NDframe implements DataFrameInterface { options?: { inplace?: boolean, atIndex?: number | string } ): DataFrame | void { let { inplace, atIndex } = { inplace: false, atIndex: this.columns.length, ...options }; - if (typeof atIndex === "string" ) { - if (!(this.columns.includes(atIndex))){ + if (typeof atIndex === "string") { + if (!(this.columns.includes(atIndex))) { throw new Error(`${atIndex} not a column`) } atIndex = this.columns.indexOf(atIndex) @@ -2762,7 +2762,7 @@ export default class DataFrame extends NDframe implements DataFrameInterface { inplace?: boolean } ): DataFrame - rename( + rename( mapper: { [index: string | number]: string | number }, @@ -3332,4 +3332,47 @@ export default class DataFrame extends NDframe implements DataFrameInterface { return toExcelNode(this, options as ExcelOutputOptionsNode) } } + + /** + * Access a single value for a row/column pair by integer position. + * Similar to {@link iloc}, in that both provide integer-based lookups. + * Use iat if you only need to get or set a single value in a DataFrame or Series. + * @param row Row index of the value to access. + * @param column Column index of the value to access. + * @example + * ``` + * const df = new DataFrame([[1, 2], [3, 4]], { columns: ['A', 'B']}) + * df.iat(0, 0) // 1 + * df.iat(0, 1) // 2 + * df.iat(1, 0) // 3 + * ``` + */ + iat(row: number, column: number): string | number | boolean { + if(typeof row === 'string' || typeof column === 'string') { + throw new Error('ParamError: row and column index must be an integer. Use .at to get a row or column by label.') + } + + return (this.values as ArrayType2D)[row][column] + } + + /** + * Access a single value for a row/column label pair. + * Similar to {@link loc}, in that both provide label-based lookups. + * Use at if you only need to get or set a single value in a DataFrame or Series. + * @param row Row index of the value to access. + * @param column Column label of the value to access. + * @example + * ``` + * const df = new DataFrame([[1, 2], [3, 4]], { columns: ['A', 'B']}) + * df.at(0,'A') // 1 + * df.at(1, 'A') // 3 + * df.at(1, 'B') // 4 + * ``` + */ + at(row: string | number, column: string): string | number | boolean { + if(typeof column !== 'string') { + throw new Error('ParamError: column index must be a string. Use .iat to get a row or column by index.') + } + return (this.values as ArrayType2D)[this.index.indexOf(row)][this.columns.indexOf(column)] + } } diff --git a/src/danfojs-base/shared/types.ts b/src/danfojs-base/shared/types.ts index 60f30b55..a8f77fd3 100644 --- a/src/danfojs-base/shared/types.ts +++ b/src/danfojs-base/shared/types.ts @@ -327,6 +327,8 @@ export interface DataFrameInterface extends NDframeInterface { toCSV(options?: CsvOutputOptionsBrowser): string | void toJSON(options?: JsonOutputOptionsBrowser): object | void toExcel(options?: ExcelOutputOptionsBrowser): void + iat(row: number, column: number): string | number | boolean + at(row: string | number, column: string): string | number | boolean } export interface DateTime { diff --git a/src/danfojs-browser/tests/core/frame.test.js b/src/danfojs-browser/tests/core/frame.test.js index d564bebd..0b171c64 100644 --- a/src/danfojs-browser/tests/core/frame.test.js +++ b/src/danfojs-browser/tests/core/frame.test.js @@ -2742,68 +2742,6 @@ describe("DataFrame", function () { }); }); - // describe("IO outputs", function () { - // it("toExcel works", async function () { - // const data = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] - // const df = new dfd.DataFrame(data, { columns: ["a", "b", "c", "d"] }); - - // const filePath = path.join(process.cwd(), "test", "samples", "test.xlsx"); - // df.toExcel({ filePath }) - - // const dfNew = await readExcel(filePath, {}); - // assert.equal(fs.existsSync(filePath), true) - // assert.deepEqual(dfNew.columns, [ - // 'a', - // 'b', - // 'c', - // 'd', - // ]); - // assert.deepEqual(dfNew.dtypes, [ - // 'int32', 'int32', - // 'int32', 'int32', - // ]); - // assert.deepEqual(dfNew.shape, [3, 4]) - // }); - - // it("toCSV works for specified seperator", async function () { - // const data = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] - // let df = new dfd.DataFrame(data, { columns: ["a", "b", "c", "d"] }); - // assert.deepEqual(df.toCSV({ sep: "+" }), `a+b+c+d\n1+2+3+4\n5+6+7+8\n9+10+11+12\n`); - // }); - // it("toCSV write to local file works", async function () { - // const data = [[1, 2, 3, "4"], [5, 6, 7, "8"], [9, 10, 11, "12"]] - // let df = new dfd.DataFrame(data, { columns: ["a", "b", "c", "d"] }); - - // const filePath = path.join(process.cwd(), "test", "samples", "test_write.csv"); - - // df.toCSV({ sep: ",", filePath }); - // assert.equal(fs.existsSync(filePath), true); - // }); - // it("toJSON works for row format", async function () { - // const data = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] - // const df = new dfd.DataFrame(data, { columns: ["a", "b", "c", "d"] }); - // const expected = { - // "a": [1, 5, 9], - // "b": [2, 6, 10], - // "c": [3, 7, 11], - // "d": [4, 8, 12], - // } - // const json = df.toJSON({ format: "row" }) - // assert.deepEqual(json, expected); - // }); - // it("toJSON writes file to local path", async function () { - // const data = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] - // const df = new dfd.DataFrame(data, { columns: ["a", "b", "c", "d"] }); - - // const rowfilePath = path.join(process.cwd(), "test", "samples", "test_row_write.json"); - // const colfilePath = path.join(process.cwd(), "test", "samples", "test_col_write.json"); - - // df.toJSON({ format: "row", filePath: rowfilePath }) - // df.toJSON({ format: "column", filePath: colfilePath }) - // assert.equal(fs.existsSync(rowfilePath), true); - // assert.equal(fs.existsSync(colfilePath), true); - // }); - // }) describe("getDummies", function () { it("getDummies works on DataFrame", function () { @@ -2902,5 +2840,51 @@ describe("DataFrame", function () { }); }); + describe("iat", function () { + it("iat works on DataFrame", function () { + const data = [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ], [ 9, 10, 11, 12 ] ]; + const columns = [ "a", "b", "c", "d" ]; + const df = new dfd.DataFrame(data, { columns }); + assert.equal(df.iat(0, 0), 1); + assert.equal(df.iat(1, 1), 6); + assert.equal(df.iat(2, 3), 12); + }); + it("throws error on string indices", function () { + const data = [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ], [ 9, 10, 11, 12 ] ]; + const columns = [ "a", "b", "c", "d" ]; + const index = [ "A", "B", "C" ]; + const df = new dfd.DataFrame(data, { columns, index }); + /* @ts-ignore */ + assert.throws(function () { df.iat("A", 0); }, Error, "ParamError: row and column index must be an integer. Use .at to get a row or column by label."); + /* @ts-ignore */ + assert.throws(function () { df.iat(0, "A"); }, Error, "ParamError: row and column index must be an integer. Use .at to get a row or column by label."); + }); + }); + + describe("at", function () { + it("at works on DataFrame", function () { + const data = [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ], [ 9, 10, 11, 12 ] ]; + const columns = [ "a", "b", "c", "d" ]; + const index = [ "A", "B", "C" ]; + const df = new dfd.DataFrame(data, { columns, index }); + assert.equal(df.at("A", "a"), 1); + assert.equal(df.at("B", "b"), 6); + assert.equal(df.at("C", "c"), 11); + + }); + it("throws error on numeric column index", function () { + const data = [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ], [ 9, 10, 11, 12 ] ]; + const columns = [ "a", "b", "c", "d" ]; + const index = [ 0, "B", "C" ]; + const df = new dfd.DataFrame(data, { columns, index }); + assert.equal(df.at(0, "b"), 2); + /* @ts-ignore */ + assert.throws(function () { df.at(0, 1); }, Error, "ParamError: column index must be a string. Use .iat to get a row or column by index."); + /* @ts-ignore */ + assert.throws(function () { df.at("B", 0); }, Error, "ParamError: column index must be a string. Use .iat to get a row or column by index."); + + }); + + }); }); diff --git a/src/danfojs-node/test/core/frame.test.ts b/src/danfojs-node/test/core/frame.test.ts index a6bf5108..18960c94 100644 --- a/src/danfojs-node/test/core/frame.test.ts +++ b/src/danfojs-node/test/core/frame.test.ts @@ -2905,5 +2905,52 @@ describe("DataFrame", function () { }); }); + describe("iat", function () { + it("iat works on DataFrame", function () { + const data = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]; + const columns = ["a", "b", "c", "d"]; + const df = new DataFrame(data, { columns }); + assert.equal(df.iat(0, 0), 1); + assert.equal(df.iat(1, 1), 6); + assert.equal(df.iat(2, 3), 12); + }); + it("throws error on string indices", function () { + const data = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]; + const columns = ["a", "b", "c", "d"]; + const index = ["A", "B", "C"]; + const df = new DataFrame(data, { columns, index }); + /* @ts-ignore */ + assert.throws(function () { df.iat("A", 0); }, Error, "ParamError: row and column index must be an integer. Use .at to get a row or column by label."); + /* @ts-ignore */ + assert.throws(function () { df.iat(0, "A"); }, Error, "ParamError: row and column index must be an integer. Use .at to get a row or column by label."); + }); + }) + + describe("at", function () { + it("at works on DataFrame", function () { + const data = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]; + const columns = ["a", "b", "c", "d"]; + const index = ["A", "B", "C"] + const df = new DataFrame(data, { columns, index }); + assert.equal(df.at("A", "a"), 1); + assert.equal(df.at("B", "b"), 6); + assert.equal(df.at("C", "c"), 11); + + }); + it("throws error on numeric column index", function () { + const data = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]; + const columns = ["a", "b", "c", "d"]; + const index = [0, "B", "C"] + const df = new DataFrame(data, { columns, index }); + + assert.equal(df.at(0, "b"), 2); + /* @ts-ignore */ + assert.throws(function () { df.at(0, 1); }, Error, "ParamError: column index must be a string. Use .iat to get a row or column by index."); + /* @ts-ignore */ + assert.throws(function () { df.at("B", 0); }, Error, "ParamError: column index must be a string. Use .iat to get a row or column by index."); + + }); + + }); }); From 93a93448df719cf0ad18c9a53ed30ed1c1b225a7 Mon Sep 17 00:00:00 2001 From: Rising Odegua Date: Wed, 19 Jan 2022 12:46:39 +0100 Subject: [PATCH 5/8] Add iat and at methods to Series --- src/danfojs-base/core/frame.ts | 8 +-- src/danfojs-base/core/series.ts | 40 ++++++++++++++ src/danfojs-base/shared/types.ts | 6 ++- src/danfojs-browser/tests/core/series.test.js | 54 +++++++++++++++++++ src/danfojs-node/test/core/series.test.ts | 54 +++++++++++++++++++ 5 files changed, 156 insertions(+), 6 deletions(-) diff --git a/src/danfojs-base/core/frame.ts b/src/danfojs-base/core/frame.ts index 0abaa457..827d70ac 100644 --- a/src/danfojs-base/core/frame.ts +++ b/src/danfojs-base/core/frame.ts @@ -3336,7 +3336,7 @@ export default class DataFrame extends NDframe implements DataFrameInterface { /** * Access a single value for a row/column pair by integer position. * Similar to {@link iloc}, in that both provide integer-based lookups. - * Use iat if you only need to get or set a single value in a DataFrame or Series. + * Use iat if you only need to get or set a single value in a DataFrame. * @param row Row index of the value to access. * @param column Column index of the value to access. * @example @@ -3347,7 +3347,7 @@ export default class DataFrame extends NDframe implements DataFrameInterface { * df.iat(1, 0) // 3 * ``` */ - iat(row: number, column: number): string | number | boolean { + iat(row: number, column: number): string | number | boolean | undefined { if(typeof row === 'string' || typeof column === 'string') { throw new Error('ParamError: row and column index must be an integer. Use .at to get a row or column by label.') } @@ -3358,7 +3358,7 @@ export default class DataFrame extends NDframe implements DataFrameInterface { /** * Access a single value for a row/column label pair. * Similar to {@link loc}, in that both provide label-based lookups. - * Use at if you only need to get or set a single value in a DataFrame or Series. + * Use at if you only need to get or set a single value in a DataFrame. * @param row Row index of the value to access. * @param column Column label of the value to access. * @example @@ -3369,7 +3369,7 @@ export default class DataFrame extends NDframe implements DataFrameInterface { * df.at(1, 'B') // 4 * ``` */ - at(row: string | number, column: string): string | number | boolean { + at(row: string | number, column: string): string | number | boolean | undefined { if(typeof column !== 'string') { throw new Error('ParamError: column index must be a string. Use .iat to get a row or column by index.') } diff --git a/src/danfojs-base/core/series.ts b/src/danfojs-base/core/series.ts index 3b9659b0..a45f0547 100644 --- a/src/danfojs-base/core/series.ts +++ b/src/danfojs-base/core/series.ts @@ -2239,4 +2239,44 @@ export default class Series extends NDframe implements SeriesInterface { return toExcelNode(this, options as ExcelOutputOptionsNode) } } + + /** + * Access a single value for a row index. + * Similar to iloc, in that both provide index-based lookups. + * Use iat if you only need to get or set a single value in a Series. + * @param row Row index of the value to access. + * @example + * ``` + * const sf = new Series([1, 2, 3, 4, 5]) + * sf.iat(0) //returns 1 + * sf.iat(1) //returns 2 + * sf.iat(2) //returns 3 + * ``` + */ + iat(row: number): number | string | boolean | undefined { + if(typeof row === 'string') { + throw new Error('ParamError: row index must be an integer. Use .at to get a row by label.') + } + return (this.values as ArrayType1D)[row]; + } + + /** + * Access a single value for a row label. + * Similar to loc, in that both provide label-based lookups. + * Use at if you only need to get or set a single value in a Series. + * @param row Row label of the value to access. + * @example + * ``` + * const sf = new Series([1, 2, 3, 4, 5, 6], { index: ['A', 'B', 'C', 'D', 'E', 'F'] }) + * sf.at('A') //returns 1 + * sf.at('B') //returns 2 + * sf.at('C') //returns 3 + * ``` + */ + at(row: string): number | string | boolean | undefined { + if(typeof row !== 'string') { + throw new Error('ParamError: row index must be a string. Use .iat to get a row by index.') + } + return (this.values as ArrayType1D)[this.index.indexOf(row)]; + } } \ No newline at end of file diff --git a/src/danfojs-base/shared/types.ts b/src/danfojs-base/shared/types.ts index a8f77fd3..7e1ca201 100644 --- a/src/danfojs-base/shared/types.ts +++ b/src/danfojs-base/shared/types.ts @@ -184,6 +184,8 @@ export interface SeriesInterface extends NDframeInterface { toCSV(options?: CsvOutputOptionsBrowser): string | void toJSON(options?: JsonOutputOptionsBrowser): object | void toExcel(options?: ExcelOutputOptionsBrowser): void + iat(index: number): number | string | boolean | undefined + at(index: string | number): number | string | boolean | undefined } //Start of DataFrame class types @@ -327,8 +329,8 @@ export interface DataFrameInterface extends NDframeInterface { toCSV(options?: CsvOutputOptionsBrowser): string | void toJSON(options?: JsonOutputOptionsBrowser): object | void toExcel(options?: ExcelOutputOptionsBrowser): void - iat(row: number, column: number): string | number | boolean - at(row: string | number, column: string): string | number | boolean + iat(row: number, column: number): number | string | boolean | undefined + at(row: string | number, column: string): number | string | boolean | undefined } export interface DateTime { diff --git a/src/danfojs-browser/tests/core/series.test.js b/src/danfojs-browser/tests/core/series.test.js index 2a5f4680..43aec234 100644 --- a/src/danfojs-browser/tests/core/series.test.js +++ b/src/danfojs-browser/tests/core/series.test.js @@ -1583,4 +1583,58 @@ describe("Series Functions", () => { }); }); + + describe("iat", function () { + it("iat works on Series", function () { + const data = [ 1, 2, 3, 4 ]; + const index = [ "a", "b", "c", "d" ]; + const df = new dfd.Series(data, { index }); + assert.equal(df.iat(0), 1); + assert.equal(df.iat(1), 2); + assert.equal(df.iat(2), 3); + }); + it("iat can return undefined", function () { + const data = [ 1, undefined, null, NaN ]; + const df = new dfd.Series(data); + assert.equal(df.iat(1), undefined); + assert.equal(df.iat(2), null); + /* @ts-ignore */ + assert.equal(isNaN(df.iat(3)), true); + }); + it("throws error on string indices", function () { + const data = [ 1, 2, 3, 4 ]; + const index = [ "a", "b", "c", "d" ]; + const df = new dfd.Series(data, { index }); + /* @ts-ignore */ + assert.throws(function () { df.iat("A"); }, Error, "ParamError: row index must be an integer. Use .at to get a row by label."); + }); + }); + + describe("at", function () { + it("at works on Series", function () { + const data = [ 1, 2, 3, 4 ]; + const index = [ "a", "b", "c", "d" ]; + const df = new dfd.Series(data, { index }); + assert.equal(df.at("a"), 1); + assert.equal(df.at("b"), 2); + assert.equal(df.at("c"), 3); + }); + it("at can return undefined", function () { + const data = [ 1, undefined, null, NaN ]; + const index = [ "a", "b", "c", "d" ]; + const df = new dfd.Series(data, { index }); + assert.equal(df.at("b"), undefined); + assert.equal(df.at("c"), null); + /* @ts-ignore */ + assert.equal(isNaN(df.at("d")), true); + }); + it("throws error on string indices", function () { + const data = [ 1, 2, 3, 4 ]; + const index = [ "a", "b", "c", "d" ]; + const df = new dfd.Series(data, { index }); + /* @ts-ignore */ + assert.throws(function () { df.at(0); }, Error, "ParamError: row index must be a string. Use .iat to get a row by index."); + }); + + }); }); diff --git a/src/danfojs-node/test/core/series.test.ts b/src/danfojs-node/test/core/series.test.ts index 9ec573cc..a7e41ae5 100644 --- a/src/danfojs-node/test/core/series.test.ts +++ b/src/danfojs-node/test/core/series.test.ts @@ -1591,4 +1591,58 @@ describe("Series Functions", () => { assert.deepEqual(sf.and(data2).index, expected); }); }); + + describe("iat", function () { + it("iat works on Series", function () { + const data = [1, 2, 3, 4]; + const index = ["a", "b", "c", "d"]; + const df = new Series(data, { index }); + assert.equal(df.iat(0), 1); + assert.equal(df.iat(1), 2); + assert.equal(df.iat(2), 3); + }); + it("iat can return undefined", function () { + const data = [1, undefined, null, NaN]; + const df = new Series(data); + assert.equal(df.iat(1), undefined); + assert.equal(df.iat(2), null); + /* @ts-ignore */ + assert.equal(isNaN(df.iat(3)), true); + }); + it("throws error on string indices", function () { + const data = [1, 2, 3, 4]; + const index = ["a", "b", "c", "d"]; + const df = new Series(data, { index }); + /* @ts-ignore */ + assert.throws(function () { df.iat("A"); }, Error, "ParamError: row index must be an integer. Use .at to get a row by label."); + }); + }) + + describe("at", function () { + it("at works on Series", function () { + const data = [1, 2, 3, 4]; + const index = ["a", "b", "c", "d"]; + const df = new Series(data, { index }); + assert.equal(df.at("a"), 1); + assert.equal(df.at("b"), 2); + assert.equal(df.at("c"), 3); + }); + it("at can return undefined", function () { + const data = [1, undefined, null, NaN]; + const index = ["a", "b", "c", "d"]; + const df = new Series(data, { index }); + assert.equal(df.at("b"), undefined); + assert.equal(df.at("c"), null); + /* @ts-ignore */ + assert.equal(isNaN(df.at("d")), true); + }); + it("throws error on string indices", function () { + const data = [1, 2, 3, 4]; + const index = ["a", "b", "c", "d"]; + const df = new Series(data, { index }); + /* @ts-ignore */ + assert.throws(function () { df.at(0); }, Error, "ParamError: row index must be a string. Use .iat to get a row by index."); + }); + + }); }) \ No newline at end of file From b410f30d857bee5d018524b69f6fe42bd8edb543 Mon Sep 17 00:00:00 2001 From: Rising Odegua Date: Wed, 19 Jan 2022 14:21:52 +0100 Subject: [PATCH 6/8] Fixes #357 --- src/danfojs-base/core/frame.ts | 4 +- src/danfojs-base/core/series.ts | 20 ++- src/danfojs-base/shared/utils.ts | 43 ++++-- src/danfojs-node/test/core/frame.test.ts | 22 ++- src/danfojs-node/test/core/series.test.ts | 163 +++++++++++++--------- 5 files changed, 165 insertions(+), 87 deletions(-) diff --git a/src/danfojs-base/core/frame.ts b/src/danfojs-base/core/frame.ts index 827d70ac..00932099 100644 --- a/src/danfojs-base/core/frame.ts +++ b/src/danfojs-base/core/frame.ts @@ -3348,7 +3348,7 @@ export default class DataFrame extends NDframe implements DataFrameInterface { * ``` */ iat(row: number, column: number): string | number | boolean | undefined { - if(typeof row === 'string' || typeof column === 'string') { + if (typeof row === 'string' || typeof column === 'string') { throw new Error('ParamError: row and column index must be an integer. Use .at to get a row or column by label.') } @@ -3370,7 +3370,7 @@ export default class DataFrame extends NDframe implements DataFrameInterface { * ``` */ at(row: string | number, column: string): string | number | boolean | undefined { - if(typeof column !== 'string') { + if (typeof column !== 'string') { throw new Error('ParamError: column index must be a string. Use .iat to get a row or column by index.') } return (this.values as ArrayType2D)[this.index.indexOf(row)][this.columns.indexOf(column)] diff --git a/src/danfojs-base/core/series.ts b/src/danfojs-base/core/series.ts index a45f0547..c8a9a9f8 100644 --- a/src/danfojs-base/core/series.ts +++ b/src/danfojs-base/core/series.ts @@ -674,9 +674,10 @@ export default class Series extends NDframe implements SeriesInterface { * //output [ 1.23, 2.4, 3.12, 4.12, 5.12 ] * ``` */ + round(dp?: number, options?: { inplace?: boolean }): Series round(dp = 1, options?: { inplace?: boolean }): Series | void { const { inplace } = { inplace: false, ...options } - + if (dp === undefined) dp = 1; const newValues = utils.round(this.values as number[], dp, true); if (inplace) { @@ -816,24 +817,26 @@ export default class Series extends NDframe implements SeriesInterface { const { ascending, inplace, } = { ascending: true, inplace: false, ...options } let sortedValues = []; + let sortedIndex = [] const rangeIdx = utils.range(0, this.index.length - 1); let sortedIdx = utils.sortArrayByIndex(rangeIdx, this.values, this.dtypes[0]); for (let indx of sortedIdx) { sortedValues.push(this.values[indx]) + sortedIndex.push(this.index[indx]) } if (ascending) { sortedValues = sortedValues.reverse(); - sortedIdx = sortedIdx.reverse(); + sortedIndex = sortedIndex.reverse(); } if (inplace) { this.$setValues(sortedValues as ArrayType1D) - this.$setIndex(sortedIdx); + this.$setIndex(sortedIndex); } else { const sf = new Series(sortedValues, { - index: sortedIdx, + index: sortedIndex, dtypes: this.dtypes, config: this.config }); @@ -1828,6 +1831,11 @@ export default class Series extends NDframe implements SeriesInterface { * //output [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ] * ``` */ + append( + newValue: string | number | boolean | Series | ArrayType1D, + index: Array | number | string, + options?: { inplace?: boolean } + ): Series append( newValue: string | number | boolean | Series | ArrayType1D, index: Array | number | string, @@ -2254,7 +2262,7 @@ export default class Series extends NDframe implements SeriesInterface { * ``` */ iat(row: number): number | string | boolean | undefined { - if(typeof row === 'string') { + if (typeof row === 'string') { throw new Error('ParamError: row index must be an integer. Use .at to get a row by label.') } return (this.values as ArrayType1D)[row]; @@ -2274,7 +2282,7 @@ export default class Series extends NDframe implements SeriesInterface { * ``` */ at(row: string): number | string | boolean | undefined { - if(typeof row !== 'string') { + if (typeof row !== 'string') { throw new Error('ParamError: row index must be a string. Use .iat to get a row by index.') } return (this.values as ArrayType1D)[this.index.indexOf(row)]; diff --git a/src/danfojs-base/shared/utils.ts b/src/danfojs-base/shared/utils.ts index 16a11df1..e24192af 100644 --- a/src/danfojs-base/shared/utils.ts +++ b/src/danfojs-base/shared/utils.ts @@ -774,27 +774,48 @@ export default class Utils { arr: Array<{ index: number | string, value: number | string | boolean }>, ascending: boolean ) { - return arr.sort((obj1, obj2) => { - const a = obj2.value; - const b = obj1.value; + let sortedValues = arr.sort((obj1, obj2) => { + let a = obj2.value; + let b = obj1.value; if (!ascending) { if (typeof a === "string" && typeof b === "string") { - return a.charCodeAt(0) - b.charCodeAt(0); - } else if ((typeof a === "number" && typeof b === "number") || (typeof a === "boolean" && typeof b === "boolean")) { - return Number(a) - Number(b); + a = a.toUpperCase(); + b = b.toUpperCase(); + + if (a < b) { + return -1; + } + + if (a > b) { + return 1; + } + + return 0; + } else { - throw Error('ParamError: column values must be either numbers or strings'); + return Number(a) - Number(b); } } else { if (typeof a === "string" && typeof b === "string") { - return b.charCodeAt(0) - a.charCodeAt(0); - } else if ((typeof a === "number" && typeof b === "number") || (typeof a === "boolean" && typeof b === "boolean")) { - return Number(b) - Number(a); + a = a.toUpperCase(); + b = b.toUpperCase(); + + if (a > b) { + return -1; + } + + if (a < b) { + return 1; + } + + return 0; } else { - throw Error('ParamError: column values must be either numbers or strings'); + return Number(b) - Number(a);; } } }); + + return sortedValues; } } \ No newline at end of file diff --git a/src/danfojs-node/test/core/frame.test.ts b/src/danfojs-node/test/core/frame.test.ts index 18960c94..76604f60 100644 --- a/src/danfojs-node/test/core/frame.test.ts +++ b/src/danfojs-node/test/core/frame.test.ts @@ -1266,7 +1266,7 @@ describe("DataFrame", function () { [2, 4, 6, "c"]]; const df = new DataFrame(data, { "columns": ["col1", "col2", "col3", "col4"] }); - const df_sort = df.sortValues("col3") as DataFrame + const df_sort = df.sortValues("col3") const expected = [[360, 180, 1, "b"], [0, 2, 4, "a"], [2, 4, 6, "c"]]; assert.deepEqual(df_sort.values, expected); assert.deepEqual(df_sort.index, [1, 0, 2]); @@ -1297,9 +1297,21 @@ describe("DataFrame", function () { [2, 4, 6, "c"]]; const df = new DataFrame(data, { "columns": ["col1", "col2", "col3", "col4"] }); - const expected = [[2, 4, 6, 'c'], [360, 180, 1, 'b'], [0, 2, 4, 'a']]; - assert.deepEqual((df.sortValues("col4", { "ascending": false }) as DataFrame).values, expected); + const expected = [[2, 4, 6, "c"], [360, 180, 1, "b"], [0, 2, 4, "a"]] + assert.deepEqual(df.sortValues("col4", { "ascending": false }).values, expected); }); + + it("sort works for Date string", function () { + const data = { + date: ['1974-02-19', '1955-12-06', '1963-11-18'] + }; + const df = new DataFrame(data); + const expected1 = [['1974-02-19'], ['1963-11-18'], ['1955-12-06']] + const expected2 = [['1955-12-06'], ['1963-11-18'], ['1974-02-19']] + assert.deepEqual(df.sortValues("date", { "ascending": false }).values, expected1); + assert.deepEqual(df.sortValues("date", { "ascending": true }).values, expected2); + }); + it("Sort duplicate DataFrame with duplicate columns", function () { const data = { @@ -1320,7 +1332,7 @@ describe("DataFrame", function () { [5, 8], [5, 2], [6, 9]]; - assert.deepEqual((df.sortValues("A", { "ascending": true }) as DataFrame).values, expected); + assert.deepEqual(df.sortValues("A", { "ascending": true }).values, expected); }); it("sort index in descending order and retains index", function () { let data = [[0, 2, 4, "b"], @@ -1330,9 +1342,9 @@ describe("DataFrame", function () { let df = new DataFrame(data, { "columns": ["col1", "col2", "col3", "col4"], index: ["b", "a", "c"] }); let df2 = df.sortIndex({ ascending: false }); let rslt = ["c", "b", "a"]; - assert.deepEqual(df2.index, rslt); }); + }); describe("copy", function () { diff --git a/src/danfojs-node/test/core/series.test.ts b/src/danfojs-node/test/core/series.test.ts index a7e41ae5..5dadec40 100644 --- a/src/danfojs-node/test/core/series.test.ts +++ b/src/danfojs-node/test/core/series.test.ts @@ -79,12 +79,12 @@ describe("Series Functions", () => { const data2 = [30, 40, 39, 1, 2, 1]; const sf = new Series(data); const sf2 = new Series(data2); - assert.deepEqual((sf.add(sf2) as Series).values, [31, 42, 42, 5, 7, 7]); + assert.deepEqual((sf.add(sf2)).values, [31, 42, 42, 5, 7, 7]); }); it("Return Addition of series with a single value (Broadcasting)", function () { const data = [1, 2, 3, 4, 5]; const sf = new Series(data); - assert.deepEqual((sf.add(1) as Series).values, [2, 3, 4, 5, 6]); + assert.deepEqual((sf.add(1)).values, [2, 3, 4, 5, 6]); }); it("Return Addition of series with another series inplace", function () { const data = [1, 2, 3, 4, 5, 6]; @@ -149,12 +149,12 @@ describe("Series Functions", () => { const data2 = [1, 2, 3, 4, 5, 6]; const sf1 = new Series(data1); const sf2 = new Series(data2); - assert.deepEqual((sf1.sub(sf2) as Series).values, [29, 38, 36, -3, -3, -5]); + assert.deepEqual((sf1.sub(sf2)).values, [29, 38, 36, -3, -3, -5]); }); it("Return Subtraction of series with a single value (Broadcasting)", function () { const data = [1, 2, 3, 4, 5]; const sf = new Series(data); - assert.deepEqual((sf.sub(1) as Series).values, [0, 1, 2, 3, 4]); + assert.deepEqual((sf.sub(1)).values, [0, 1, 2, 3, 4]); }); it("Throws type error on Subtraction of string type", function () { const data = [1, 2, 3, 4]; @@ -184,12 +184,12 @@ describe("Series Functions", () => { const data2 = [1, 2, 3, 4]; const sf1 = new Series(data1); const sf2 = new Series(data2); - assert.deepEqual((sf1.mul(sf2) as Series).values, [30, 80, 9, 20]); + assert.deepEqual((sf1.mul(sf2)).values, [30, 80, 9, 20]); }); it("Return multiplication of series with a single value (Broadcasting)", function () { const data = [1, 2, 3, 4, 5]; const sf = new Series(data); - assert.deepEqual((sf.mul(1) as Series).values, [1, 2, 3, 4, 5]); + assert.deepEqual((sf.mul(1)).values, [1, 2, 3, 4, 5]); }); it("Throws type error on multiplication of string type", function () { const data = [1, 2, 3, 4] @@ -214,19 +214,19 @@ describe("Series Functions", () => { const data2 = [1, 2, 3, 4]; const sf1 = new Series(data1); const sf2 = new Series(data2); - assert.deepEqual((sf1.div(sf2) as Series).values, [30, 20, 1, 1.25]); + assert.deepEqual((sf1.div(sf2)).values, [30, 20, 1, 1.25]); }); it("Return integer division of series with another series", function () { const data1 = [30, 40, 3, 5]; const data2 = [1, 2, 3, 4]; const sf1 = new Series(data1); const sf2 = new Series(data2); - assert.deepEqual((sf1.div(sf2) as Series).values, [30, 20, 1, 1.25]); + assert.deepEqual((sf1.div(sf2)).values, [30, 20, 1, 1.25]); }); it("Return division of series with a single value (Broadcasting)", function () { const data = [10, 2, 3, 90]; const sf = new Series(data); - assert.deepEqual((sf.div(2) as Series).values, [5, 1, 1.5, 45]); + assert.deepEqual((sf.div(2)).values, [5, 1, 1.5, 45]); }); it("Throws type error on division of string type", function () { const data = [1, 2, 3, 4] @@ -250,12 +250,12 @@ describe("Series Functions", () => { const data2 = [1, 2, 3, 0]; const sf1 = new Series(data1); const sf2 = new Series(data2); - assert.deepEqual((sf1.pow(sf2) as Series).values, [2, 9, 64, 1]); + assert.deepEqual((sf1.pow(sf2)).values, [2, 9, 64, 1]); }); it("Return Exponetial power of series with a single value (Broadcasting)", function () { const data = [1, 2, 3, 4, 5]; const sf = new Series(data); - assert.deepEqual((sf.pow(2) as Series).values, [1, 4, 9, 16, 25]); + assert.deepEqual((sf.pow(2)).values, [1, 4, 9, 16, 25]); }); }); @@ -271,19 +271,19 @@ describe("Series Functions", () => { 0.7000000000000002, 0.20000000000000018 ]; - assert.deepEqual((sf1.mod(sf2) as Series).values, expected); + assert.deepEqual((sf1.mod(sf2)).values, expected); }); it("Return modulo of series with another int series", function () { const data1 = [2, 30, 4, 5]; const data2 = [1, 2, 3, 1]; const sf1 = new Series(data1); const sf2 = new Series(data2); - assert.deepEqual((sf1.mod(sf2) as Series).values, [0, 0, 1, 0]); + assert.deepEqual((sf1.mod(sf2)).values, [0, 0, 1, 0]); }); it("Return modulo power of series with a single value (Broadcasting)", function () { const data = [1, 2, 3, 4, 5]; const sf = new Series(data); - assert.deepEqual((sf.mod(2) as Series).values, [1, 0, 1, 0, 1]); + assert.deepEqual((sf.mod(2)).values, [1, 0, 1, 0, 1]); }); }); @@ -508,17 +508,17 @@ describe("Series Functions", () => { it("Rounds elements in a Series to nearest whole number", function () { const data1 = [30.21091, 40.190901, 3.564, 5.0212]; const sf = new Series(data1); - assert.deepEqual((sf.round() as Series).values, [30.2, 40.2, 3.6, 5]); + assert.deepEqual((sf.round()).values, [30.2, 40.2, 3.6, 5]); }); it("Rounds elements in a Series to 1dp", function () { const data1 = [30.21091, 40.190901, 3.564, 5.0212]; const sf = new Series(data1); - assert.deepEqual((sf.round(1) as Series).values, [30.2, 40.2, 3.6, 5.0]); + assert.deepEqual((sf.round(1)).values, [30.2, 40.2, 3.6, 5.0]); }); it("Rounds elements in a Series to 2dp", function () { const data1 = [30.2191, 40.190901, 3.564, 5.0212]; const sf = new Series(data1); - assert.deepEqual((sf.round(2) as Series).values, [30.22, 40.19, 3.56, 5.02]); + assert.deepEqual((sf.round(2)).values, [30.22, 40.19, 3.56, 5.02]); }); it("Rounds elements in a Series to 2dp inplace", function () { @@ -630,14 +630,14 @@ describe("Series Functions", () => { const sf = new Series(data); const sfVal = ["filled", "boy", "filled", "hey", "Man", "filled"]; const sfFill = sf.fillNa("filled"); - assert.deepEqual((sfFill as Series).values, sfVal); + assert.deepEqual((sfFill).values, sfVal); }); it("Data is in right format after filling", function () { const data = [NaN, "boy", NaN, "hey", "Man", undefined]; const sf = new Series(data); const sfVal = ["filled", "boy", "filled", "hey", "Man", "filled"]; const sfFill = sf.fillNa("filled"); - assert.deepEqual((sfFill as Series).values, sfVal); + assert.deepEqual((sfFill).values, sfVal); }); }); @@ -646,7 +646,7 @@ describe("Series Functions", () => { const sf = new Series([20, 30, 1, 2, 4, 57, 89, 0, 4]); const result = [0, 1, 2, 4, 4, 20, 30, 57, 89]; const sortedSf = sf.sortValues(); - assert.deepEqual((sortedSf as Series).values, result); + assert.deepEqual((sortedSf).values, result); }); it("confirms that sortValues in ascending order does not happen inplace", function () { @@ -660,8 +660,8 @@ describe("Series Functions", () => { it("Sort values in a Series in Descending order", function () { const sf = new Series([20, 30, 1, 2, 4, 57, 89, 0, 4]); const result = [89, 57, 30, 20, 4, 4, 2, 1, 0]; - const sortedSf = sf.sortValues({ascending: false}); - assert.deepEqual((sortedSf as Series).values, result); + const sortedSf = sf.sortValues({ ascending: false }); + assert.deepEqual((sortedSf).values, result); }); it("confirms that sortValues in descending order happens inplace", function () { const sf = new Series([20, 30, 1, 2, 4, 57, 89, 0, 4]); @@ -672,28 +672,65 @@ describe("Series Functions", () => { it("Confirms that series index is sorted in ascending order (not in inplace)", function () { const sf = new Series([20, 30, 1, 2, 4, 57, 89, 0, 4]); const result = [7, 2, 3, 8, 4, 0, 1, 5, 6]; - const sortedSf = sf.sortValues() as Series + const sortedSf = sf.sortValues() assert.deepEqual(sortedSf.index, result); }); it("Confirms that series index is sorted in descending order (not in inplace)", function () { const sf = new Series([20, 30, 1, 2, 4, 57, 89, 0, 4]); const result = [6, 5, 1, 0, 4, 8, 3, 2, 7]; - const sortedSf = sf.sortValues({ ascending: false}) as Series + const sortedSf = sf.sortValues({ ascending: false }) assert.deepEqual(sortedSf.index, result); }); it("Sort string values in a Series", function () { const sf = new Series(["boy", "zebra", "girl", "man"]); const result = ["boy", "girl", "man", "zebra"]; - const sortedSf = sf.sortValues({ ascending: false}) as Series + const sortedSf = sf.sortValues({ ascending: false }) assert.deepEqual(sortedSf.values, result); }); + it("Index is retained after sort (ascending=true)", function () { + let index = ["apple", "banana", "orange", "grape"]; + let value = [3, 6, 2, 9]; + + let sf = new Series(value, { index }); + sf.sortValues().print(); + const expectedValues = [2, 3, 6, 9]; + const expectedIndex = ["orange", "apple", "banana", "grape"]; + const sortedSf = sf.sortValues() + assert.deepEqual(sortedSf.values, expectedValues); + assert.deepEqual(sortedSf.index, expectedIndex); + }); + it("Index is retained after sort (ascending=false)", function () { + let index = ["apple", "banana", "orange", "grape"]; + let value = [3, 6, 2, 9]; + + let sf = new Series(value, { index }); + sf.sortValues().print(); + const expectedValues = [9, 6, 3, 2]; + const expectedIndex = ["grape", "banana", "apple", "orange"]; + const sortedSf = sf.sortValues({ ascending: false }) + assert.deepEqual(sortedSf.values, expectedValues); + assert.deepEqual(sortedSf.index, expectedIndex); + }); + + it("Index is retained after inplace sort (ascending=false)", function () { + let index = ["apple", "banana", "orange", "grape"]; + let value = [3, 6, 2, 9]; + + let sf = new Series(value, { index }); + sf.sortValues().print(); + const expectedValues = [9, 6, 3, 2]; + const expectedIndex = ["grape", "banana", "apple", "orange"]; + sf.sortValues({ ascending: false, inplace: true }); + assert.deepEqual(sf.values, expectedValues); + assert.deepEqual(sf.index, expectedIndex); + }); }); describe("describe", function () { it("Computes the descriptive statistics on an int Series", function () { const data1 = [10, 45, 56, 25, 23, 20, 10]; const sf = new Series(data1) - assert.deepEqual((sf.describe().round() as Series).values, [ + assert.deepEqual(sf.describe().round().values, [ 7, 27, 17.4, @@ -706,7 +743,7 @@ describe("Series Functions", () => { it("Computes the descriptive statistics on a float Series", function () { const data1 = [30.1, 40.2, 3.1, 5.1]; const sf = new Series(data1); - assert.deepEqual((sf.describe().round() as Series).values, [ + assert.deepEqual(sf.describe().round().values, [ 4, 19.6, 18.4, @@ -739,13 +776,13 @@ describe("Series Functions", () => { { alpha: "C", count: 3 } ]; const df = new Series(data, { index: ["one", "two", "three"] }); - const dfReset = df.resetIndex() as Series + const dfReset = df.resetIndex() assert.deepEqual(dfReset.index, [0, 1, 2]); }); it("Reset the index of a Series created from an Array", function () { const data = [1, 2, 3, 4, 5, 6]; const df = new Series(data, { index: ["one", "two", "three", "four", "five", "six"] }); - const dfNew = df.resetIndex() as Series + const dfNew = df.resetIndex() assert.deepEqual(dfNew.index, [0, 1, 2, 3, 4, 5]); }); it("checks that the original series changed after reseting new index inplace", function () { @@ -768,7 +805,7 @@ describe("Series Functions", () => { { alpha: "C", count: 3 } ]; const df = new Series(data); - const dfNew = df.setIndex(["one", "two", "three"]) as Series + const dfNew = df.setIndex(["one", "two", "three"]) assert.deepEqual(dfNew.index, ["one", "two", "three"]); assert.notDeepEqual(df.index, dfNew.index); }); @@ -779,7 +816,7 @@ describe("Series Functions", () => { { alpha: "C", count: 3 } ]; const df = new Series(data); - const dfNew = df.setIndex(["one", "two", "three"]) as Series + const dfNew = df.setIndex(["one", "two", "three"]) assert.notDeepEqual(df.index, dfNew.index); }); it("sets the index of an Series inplace", function () { @@ -805,7 +842,7 @@ describe("Series Functions", () => { const sf = new Series([1, 2, 3, 4]); const map = { 1: "ok", 2: "okie", 3: "frit", 4: "gop" }; const rslt = ["ok", "okie", "frit", "gop"]; - assert.deepEqual((sf.map(map) as Series).values, rslt); + assert.deepEqual((sf.map(map)).values, rslt); }); it("map series element to object keys inplace", function () { const sf = new Series([1, 2, 3, 4]); @@ -827,7 +864,7 @@ describe("Series Functions", () => { return x + 1; }; const rslt = [2, 3, 4, 5]; - assert.deepEqual((sf.map(func_map) as Series).values, rslt); + assert.deepEqual((sf.map(func_map)).values, rslt); }); it("map series element to a function statement inplace", function () { @@ -841,14 +878,14 @@ describe("Series Functions", () => { }); it("map passes along the index", function () { - const sf = new Series([ 1, 2, 3, 4 ]); + const sf = new Series([1, 2, 3, 4]); const func_map = (x: any, i: any) => { - return x + i; + return x + i; }; - const rslt = [ 1, 3, 5, 7 ]; + const rslt = [1, 3, 5, 7]; sf.map(func_map, { inplace: true }); assert.deepEqual(sf.values, rslt); - }); + }); }); describe("Apply", function () { @@ -859,7 +896,7 @@ describe("Series Functions", () => { }; const rslt = [2, 4, 6, 8, 10, 12, 14, 16]; - assert.deepEqual((sf.apply(applyFunc) as Series).values, rslt); + assert.deepEqual((sf.apply(applyFunc)).values, rslt); }); it("apply a function to a series element inplace", function () { @@ -931,12 +968,12 @@ describe("Series Functions", () => { it("Returns the absolute values in Series", function () { const data1 = [-10, 45, 56, -25, 23, -20, 10]; const sf = new Series(data1); - assert.deepEqual((sf.abs() as Series).values, [10, 45, 56, 25, 23, 20, 10]); + assert.deepEqual((sf.abs()).values, [10, 45, 56, 25, 23, 20, 10]); }); it("Computes the descriptive statistics on a float Series", function () { const data1 = [-30.1, -40.2, -3.1, -5.1]; const sf = new Series(data1); - assert.deepEqual((sf.abs() as Series).values, [30.1, 40.2, 3.1, 5.1]); + assert.deepEqual((sf.abs()).values, [30.1, 40.2, 3.1, 5.1]); }); }); @@ -944,7 +981,7 @@ describe("Series Functions", () => { it("Return cumulative sum over a Series", function () { const data1 = [10, 45, 56, 25, 23, 20, 10]; const sf = new Series(data1); - assert.deepEqual((sf.cumSum() as Series).values, [10, 55, 111, 136, 159, 179, 189]); + assert.deepEqual((sf.cumSum()).values, [10, 55, 111, 136, 159, 179, 189]); }); it("Return cumulative sum over a Series inplace", function () { const data1 = [10, 45, 56, 25, 23, 20, 10]; @@ -958,7 +995,7 @@ describe("Series Functions", () => { it("Return cumulative maximum over a Series", function () { const data1 = [10, 45, 56, 25, 23, 20, 10]; const sf = new Series(data1); - assert.deepEqual((sf.cumMax() as Series).values, [10, 45, 56, 56, 56, 56, 56]); + assert.deepEqual((sf.cumMax()).values, [10, 45, 56, 56, 56, 56, 56]); }); it("Return cumulative maximum over a Series inplace", function () { const data1 = [10, 45, 56, 25, 23, 20, 10]; @@ -972,7 +1009,7 @@ describe("Series Functions", () => { it("Return cumulative minimum over a Series", function () { const data1 = [10, 45, 56, 25, 23, 20, 10]; const sf = new Series(data1); - assert.deepEqual((sf.cumMin() as Series).values, [10, 10, 10, 10, 10, 10, 10]); + assert.deepEqual((sf.cumMin()).values, [10, 10, 10, 10, 10, 10, 10]); }); }); @@ -981,7 +1018,7 @@ describe("Series Functions", () => { const data1 = [1, 2, 10, 3, 12, 14, 1]; const sf = new Series(data1); const rslt = [1, 2, 20, 60, 720, 10080, 10080]; - assert.deepEqual((sf.cumProd() as Series).values, rslt); + assert.deepEqual((sf.cumProd()).values, rslt); }); }); @@ -1122,7 +1159,7 @@ describe("Series Functions", () => { const data1 = [10, 45, 56, 25, 23, 20, 10]; const sf = new Series(data1); const expected = [-50, 45, 56, 25, 23, 20, -50]; - const dfRep = sf.replace(10, -50) as Series + const dfRep = sf.replace(10, -50) assert.deepEqual(dfRep.values, expected); }); @@ -1159,7 +1196,7 @@ describe("Series Functions", () => { const sf = new Series(data1); const expected = [10, 45, 56, 23, 20]; const expectedIndex = [0, 1, 2, 4, 5]; - const df_drop = sf.dropDuplicates() as Series + const df_drop = sf.dropDuplicates() assert.deepEqual(df_drop.values, expected); assert.deepEqual(df_drop.index, expectedIndex); }); @@ -1169,7 +1206,7 @@ describe("Series Functions", () => { const sf = new Series(data1); const expected = [45, 56, 23, 20, 10]; const expectedIndex = [1, 2, 4, 5, 7]; - const df_drop = sf.dropDuplicates({ keep: "last" }) as Series + const df_drop = sf.dropDuplicates({ keep: "last" }) assert.deepEqual(df_drop.values, expected); assert.deepEqual(df_drop.index, expectedIndex); }); @@ -1191,7 +1228,7 @@ describe("Series Functions", () => { const sf = new Series(data1); const expected = [10, 45, 10, 23, 20, 10]; const expectedIndex = [0, 1, 3, 4, 5, 7]; - const sfDrop = sf.dropNa() as Series + const sfDrop = sf.dropNa() assert.deepEqual(sfDrop.values, expected); assert.deepEqual(sfDrop.index, expectedIndex); assert.deepEqual(sfDrop.shape, [6, 1]); @@ -1203,7 +1240,7 @@ describe("Series Functions", () => { const expected = ["A", "A", "B", "B", "C"]; const expectedIndex = [0, 2, 3, 4, 6]; - sf.dropNa({ inplace: true }) as Series + sf.dropNa({ inplace: true }) assert.deepEqual(sf.values, expected); assert.deepEqual(sf.index, expectedIndex); assert.deepEqual(sf.shape, [5, 1]); @@ -1223,7 +1260,7 @@ describe("Series Functions", () => { const data1 = [10.22, 4.5, 2.0, 10, 23.23, 20.1, 30, 11]; const sf = new Series(data1); const expected = [6, 4, 5, 7, 0, 3, 1, 2]; - const sf_sort = sf.argSort({ ascending: false}); + const sf_sort = sf.argSort({ ascending: false }); assert.deepEqual(sf_sort.values, expected); }); }); @@ -1276,20 +1313,20 @@ describe("Series Functions", () => { const data = ["lower", "CAPITALS", "this is a sentence", "SwApCaSe"]; const res = ["lower", "capitals", "this is a sentence", "swapcase"]; const sf = new Series(data); - assert.deepEqual((sf.str.toLowerCase() as Series).values, res); + assert.deepEqual((sf.str.toLowerCase()).values, res); }); it("Converts all characters to capital case.", function () { const data = ["lower", "CAPITALS", "this is a sentence", "SwApCaSe"]; const res = ["Lower", "Capitals", "This is a sentence", "Swapcase"]; const sf = new Series(data); - assert.deepEqual((sf.str.capitalize() as Series).values, res); + assert.deepEqual((sf.str.capitalize()).values, res); }); it("Returns the character at the specified index (position)", function () { const data = ["lower", "CAPITALS", "this is a sentence", "SwApCaSe"]; const res = ["w", "P", "i", "A"]; const sf = new Series(data); - assert.deepEqual((sf.str.charAt(2) as Series).values, res); + assert.deepEqual((sf.str.charAt(2)).values, res); }); it("Throws error on concat of numeric series", function () { @@ -1340,7 +1377,7 @@ describe("Series Functions", () => { it("set type of float column to int", function () { const data = [-20.1, 30, 47.3, -20]; const ndframe = new Series(data); - const df = ndframe.asType("int32") as Series + const df = ndframe.asType("int32") assert.deepEqual(df.dtypes[0], "int32"); assert.deepEqual(df.values, [-20, 30, 47, -20]); @@ -1348,14 +1385,14 @@ describe("Series Functions", () => { it("set type of int column to float", function () { const data = [34, -4, 5, 6]; const ndframe = new Series(data); - const df = ndframe.asType("float32") as Series + const df = ndframe.asType("float32") assert.deepEqual(df.dtypes[0], "float32"); assert.deepEqual(df.values, [34, -4, 5, 6]); }); it("set type of string column to int", function () { const data = ["20.1", "21", "23.4", "50.78"]; const ndframe = new Series(data); - const df = ndframe.asType("int32") as Series + const df = ndframe.asType("int32") assert.deepEqual(df.dtypes[0], "int32"); assert.deepEqual(df.values, [20, 21, 23, 50]); @@ -1363,7 +1400,7 @@ describe("Series Functions", () => { it("set type of string column to float", function () { const data = ["20.1", "21", "23.4", "50.78"]; const ndframe = new Series(data); - const df = ndframe.asType("float32") as Series + const df = ndframe.asType("float32") assert.deepEqual(df.dtypes[0], "float32"); assert.deepEqual(df.values, [20.1, 21, 23.4, 50.78]); @@ -1371,14 +1408,14 @@ describe("Series Functions", () => { it("set type of float column to string", function () { const data = [-20.1, 30, 47.3, -20]; const ndframe = new Series(data); - const df = ndframe.asType("string") as Series + const df = ndframe.asType("string") assert.deepEqual(df.dtypes[0], "string"); assert.deepEqual(df.values, ["-20.1", "30", "47.3", "-20"]); }); it("set type of int column to string", function () { const data = [34, -4, 5, 6]; const ndframe = new Series(data); - const df = ndframe.asType("string") as Series + const df = ndframe.asType("string") assert.deepEqual(df.dtypes[0], "string"); assert.deepEqual(df.values, ["34", "-4", "5", "6"]); }); @@ -1420,7 +1457,7 @@ describe("Series Functions", () => { const data = [1, 2, 3, 4, "a", "b", "c"]; const sf = new Series(data); const expected_val = [1, 2, 3, 4, "a", "b", "c", "d"]; - const sf2 = sf.append("d", 7) as Series + const sf2 = sf.append("d", 7) assert.deepEqual(sf2.values, expected_val); }); it("Add a new array of values to the end of a Series", function () { @@ -1429,7 +1466,7 @@ describe("Series Functions", () => { const index = [4, 5, 6]; const sf = new Series(data); const expected_val = [1, 2, 3, 4, "a", "b", "c"]; - const sf2 = sf.append(to_add, index) as Series; + const sf2 = sf.append(to_add, index); assert.deepEqual(sf2.values, expected_val); }); it("Add a Series to the end of another Series", function () { @@ -1437,14 +1474,14 @@ describe("Series Functions", () => { const sf2 = new Series(["a", "b", "c"]); const index = [4, 5, 6]; const expected_val = [1, 2, 3, 4, "a", "b", "c"]; - const sf3 = sf1.append(sf2, index) as Series; + const sf3 = sf1.append(sf2, index); assert.deepEqual(sf3.values, expected_val); }); it("Confirm index Change after append", function () { const sf1 = new Series([1, 2, 3, 4]); const sf2 = new Series(["a", "b", "c"]); const index = [4, 5, 6]; - const sf3 = sf1.append(sf2, index) as Series; + const sf3 = sf1.append(sf2, index); assert.deepEqual(sf3.index, [0, 1, 2, 3, 4, 5, 6]); }); it("Confirm index Change after append inplace", function () { From 06a5b51bc5cb613e8270856ec04c258d3bc75a56 Mon Sep 17 00:00:00 2001 From: Rising Odegua Date: Wed, 19 Jan 2022 14:25:57 +0100 Subject: [PATCH 7/8] Update test in browser for sortValues --- src/danfojs-browser/tests/core/frame.test.js | 11 ++++++ src/danfojs-browser/tests/core/series.test.js | 39 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/danfojs-browser/tests/core/frame.test.js b/src/danfojs-browser/tests/core/frame.test.js index 0b171c64..515f7f07 100644 --- a/src/danfojs-browser/tests/core/frame.test.js +++ b/src/danfojs-browser/tests/core/frame.test.js @@ -1319,6 +1319,17 @@ describe("DataFrame", function () { [ 6, 9 ] ]; assert.deepEqual(df.sortValues("A", { "ascending": true }).values, expected); }); + + it("sort index in descending order and retains index", function () { + let data = [ [ 0, 2, 4, "b" ], + [ 360, 180, 360, "a" ], + [ 2, 4, 6, "c" ] ]; + + let df = new dfd.DataFrame(data, { "columns": [ "col1", "col2", "col3", "col4" ], index: [ "b", "a", "c" ] }); + let df2 = df.sortIndex({ ascending: false }); + let rslt = [ "c", "b", "a" ]; + assert.deepEqual(df2.index, rslt); + }); }); describe("copy", function () { diff --git a/src/danfojs-browser/tests/core/series.test.js b/src/danfojs-browser/tests/core/series.test.js index 43aec234..23b6ce7f 100644 --- a/src/danfojs-browser/tests/core/series.test.js +++ b/src/danfojs-browser/tests/core/series.test.js @@ -688,6 +688,45 @@ describe("Series Functions", () => { const sortedSf = sf.sortValues({ ascending: false }); assert.deepEqual(sortedSf.values, result); }); + + it("Index is retained after sort (ascending=true)", function () { + let index = [ "apple", "banana", "orange", "grape" ]; + let value = [ 3, 6, 2, 9 ]; + + let sf = new dfd.Series(value, { index }); + sf.sortValues().print(); + const expectedValues = [ 2, 3, 6, 9 ]; + const expectedIndex = [ "orange", "apple", "banana", "grape" ]; + const sortedSf = sf.sortValues(); + assert.deepEqual(sortedSf.values, expectedValues); + assert.deepEqual(sortedSf.index, expectedIndex); + }); + it("Index is retained after sort (ascending=false)", function () { + let index = [ "apple", "banana", "orange", "grape" ]; + let value = [ 3, 6, 2, 9 ]; + + let sf = new dfd.Series(value, { index }); + sf.sortValues().print(); + const expectedValues = [ 9, 6, 3, 2 ]; + const expectedIndex = [ "grape", "banana", "apple", "orange" ]; + const sortedSf = sf.sortValues({ ascending: false }); + assert.deepEqual(sortedSf.values, expectedValues); + assert.deepEqual(sortedSf.index, expectedIndex); + }); + + it("Index is retained after inplace sort (ascending=false)", function () { + let index = [ "apple", "banana", "orange", "grape" ]; + let value = [ 3, 6, 2, 9 ]; + + let sf = new dfd.Series(value, { index }); + sf.sortValues().print(); + const expectedValues = [ 9, 6, 3, 2 ]; + const expectedIndex = [ "grape", "banana", "apple", "orange" ]; + sf.sortValues({ ascending: false, inplace: true }); + assert.deepEqual(sf.values, expectedValues); + assert.deepEqual(sf.index, expectedIndex); + }); + }); describe("describe", function () { From 0d33e344b80a3ed54c91c9393ac3b583d4b0b1a4 Mon Sep 17 00:00:00 2001 From: Rising Odegua Date: Wed, 19 Jan 2022 14:39:36 +0100 Subject: [PATCH 8/8] Update patch version --- README.md | 4 ++-- package.json | 1 + src/danfojs-base/index.ts | 2 +- src/danfojs-base/package.json | 2 +- src/danfojs-browser/README.md | 4 ++-- src/danfojs-browser/package.json | 2 +- src/danfojs-node/README.md | 4 ++-- src/danfojs-node/package.json | 2 +- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a3cbeada..0183c187 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ yarn add danfojs For use directly in HTML files, you can add the latest script tag from [JsDelivr](https://www.jsdelivr.com/package/npm/danfojs) to your HTML file: ```html - + ``` See all available versions [here](https://www.jsdelivr.com/package/npm/danfojs) @@ -85,7 +85,7 @@ See all available versions [here](https://www.jsdelivr.com/package/npm/danfojs) - + Document diff --git a/package.json b/package.json index cc9521cf..834a1109 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "danfo", + "version": "1.0.2", "private": true, "workspaces": [ "danfojs-node/**", diff --git a/src/danfojs-base/index.ts b/src/danfojs-base/index.ts index e1ff1e24..b401120c 100644 --- a/src/danfojs-base/index.ts +++ b/src/danfojs-base/index.ts @@ -29,7 +29,7 @@ import merge from "./transformers/merge" import dateRange from "./core/daterange" import tensorflow from "./shared/tensorflowlib" -const __version = "1.0.1"; +const __version = "1.0.2"; export { NDframe, diff --git a/src/danfojs-base/package.json b/src/danfojs-base/package.json index 5b8e6a41..5cbc3811 100644 --- a/src/danfojs-base/package.json +++ b/src/danfojs-base/package.json @@ -1,6 +1,6 @@ { "name": "danfojs-base", - "version": "1.0.0", + "version": "1.0.2", "description": "Base package used in danfojs-node and danfojs-browser", "main": "index.ts", "scripts": { diff --git a/src/danfojs-browser/README.md b/src/danfojs-browser/README.md index 98fbf1da..e0bfe03c 100644 --- a/src/danfojs-browser/README.md +++ b/src/danfojs-browser/README.md @@ -71,7 +71,7 @@ yarn add danfojs For use directly in HTML files, you can add the latest script tag from [JsDelivr](https://www.jsdelivr.com/package/npm/danfojs) to your HTML file: ```html - + ``` See all available versions [here](https://www.jsdelivr.com/package/npm/danfojs) @@ -86,7 +86,7 @@ See all available versions [here](https://www.jsdelivr.com/package/npm/danfojs) - + Document diff --git a/src/danfojs-browser/package.json b/src/danfojs-browser/package.json index 4b1ca34e..e0d074f1 100644 --- a/src/danfojs-browser/package.json +++ b/src/danfojs-browser/package.json @@ -1,6 +1,6 @@ { "name": "danfojs", - "version": "1.0.1", + "version": "1.0.2", "description": "JavaScript library providing high performance, intuitive, and easy to use data structures for manipulating and processing structured data.", "main": "dist/danfojs-browser/src/index.js", "types": "dist/danfojs-browser/src/index.d.ts", diff --git a/src/danfojs-node/README.md b/src/danfojs-node/README.md index 98fbf1da..e0bfe03c 100644 --- a/src/danfojs-node/README.md +++ b/src/danfojs-node/README.md @@ -71,7 +71,7 @@ yarn add danfojs For use directly in HTML files, you can add the latest script tag from [JsDelivr](https://www.jsdelivr.com/package/npm/danfojs) to your HTML file: ```html - + ``` See all available versions [here](https://www.jsdelivr.com/package/npm/danfojs) @@ -86,7 +86,7 @@ See all available versions [here](https://www.jsdelivr.com/package/npm/danfojs) - + Document diff --git a/src/danfojs-node/package.json b/src/danfojs-node/package.json index 7d2ccc2f..bfeecf17 100644 --- a/src/danfojs-node/package.json +++ b/src/danfojs-node/package.json @@ -1,6 +1,6 @@ { "name": "danfojs-node", - "version": "1.0.1", + "version": "1.0.2", "description": "JavaScript library providing high performance, intuitive, and easy to use data structures for manipulating and processing structured data.", "main": "dist/danfojs-node/src/index.js", "types": "dist/danfojs-node/src/index.d.ts",