{"id":19768321,"url":"https://github.com/matiasvlevi/csvdn","last_synced_at":"2026-05-10T22:49:30.287Z","repository":{"id":129686082,"uuid":"440695847","full_name":"matiasvlevi/csvdn","owner":"matiasvlevi","description":"CSV Data Normalizer","archived":false,"fork":false,"pushed_at":"2022-03-21T22:15:30.000Z","size":369,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T10:59:22.391Z","etag":null,"topics":["csv","data-science","normalization"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matiasvlevi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-22T01:17:02.000Z","updated_at":"2021-12-25T05:40:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"90baf85d-2599-4ab7-923a-613198242258","html_url":"https://github.com/matiasvlevi/csvdn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/matiasvlevi/csvdn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasvlevi%2Fcsvdn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasvlevi%2Fcsvdn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasvlevi%2Fcsvdn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasvlevi%2Fcsvdn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matiasvlevi","download_url":"https://codeload.github.com/matiasvlevi/csvdn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasvlevi%2Fcsvdn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32874700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"ssl_error","status_checked_at":"2026-05-10T13:40:02.145Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","data-science","normalization"],"created_at":"2024-11-12T04:37:16.559Z","updated_at":"2026-05-10T22:49:30.252Z","avatar_url":"https://github.com/matiasvlevi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSVDN\n\nCSVDN normalizes column data from csv files.\n\n## Install\n\n```sh\nnpm i csvdn\n```\n\n## Import\n\n```js\nconst { CSVDN } = require('csvdn');\n```\n\n\u003cbr/\u003e\n\n## Example\n\nHere is a csv file with sample data\n```csv\nAge,Sex,Heartrate\n19, M, 99\n23, F, 98\n45, M, 89\n26, M, 93\n34, F, 94\n21, F, 96\n```\n\nCreate a csv normalizer instance with your csv file path\n\n```js\nlet csv = new CSVDN('./path/to/your/file.csv');\n```\n\nSpecify the column names of your data and their normalization operation. If a column is not specified here, it will not be included in the output file.\n\n```js\ncsv.add('Age',{\n  mode:'map'\n});\n\ncsv.add('Sex',{\n  mode:'bool'\n})\n\ncsv.add('Heartrate',{\n  mode:'map'\n})\n```\n\nCall the `normalize` method\n\n```js\ncsv.normalize();\n```\n\nSave the normalized CSV\n\n```js\nlet file = csv.getFile();\nfs.writeFileSync('./your/write/path/file2.csv', file, 'utf8');\n```\n\nThis would create a normalized version of this csv file:\n\n```csv\nAge,Sex,Heartrate\n0.4222222222222222,0,1\n0.5111111111111111,1,0.98989898989899\n1,0,0.898989898989899\n0.5777777777777777,0,0.9393939393939394\n0.7555555555555555,1,0.9494949494949495\n0.4666666666666667,1,0.9696969696969697\n```\n\n\u003cbr/\u003e\n\n## Log\n\nYou can use the log method in order to print the file\n\n```js\ncsv.log();\ncsv.log({ normalized: true });\n```\n\nYou can specify other options: \n\n| Property   | Type   | Description                                |\n|------------|--------|--------------------------------------------|\n| normalized | bool   | log normalized data if true                |\n| join       | string | character with which to join columns       |\n| header     | bool   | include the header                         |\n| tab        | bool   | include tabulation                         |\n| align      | string | Align text either `'left'`, `'right'`      |\n| color      | bool   | whether or not to include color in the log |\n\n\n\u003cbr/\u003e\n\n## get the file as a string\n\n```js\nlet normfile = csv.getFile();\n```\n\nThis method acts exactly as `log`, but returns a string of the supposed log. The same options apply for `getFile`, altough the default config is opimal for writing csv's.\n\n\u003cbr/\u003e\n\n## Register Operation\nIf you want to normalize a column with some other operation than the ones provided as default, you can register your own operation.\n\nSpecify a name, and an operation function.\nThe operation function is fed 2 arguments, a list of the values in the column, a config object containing usefull properties. This function must also return a list of numeric normalized values.\n```js\nCSVDN.registerOperation('myOperation', (values, config) =\u003e {\n  let ans = [];\n\n  // Divide by maximum value in the column.\n  for (let i = 0; i \u003c values.length; i++) {\n    ans.push(values[i] / config.max);\n  }\n\n  return ans;\n});\n```\n```js\ncsv.add('MyColumn',{\n  mode:'myOperation'\n});\n```\n\n\u003cbr/\u003e\n\n### Add config properties\n\nProperties added can be found in the config object.\n\n```js\nCSVDN.registerOperation('myOperation', (values, config) =\u003e {\n  // `config` also includes specified properties, try:\n  // console.log(config.foo, config.bar)\n});\n\n```\n```js\ncsv.add('MyColumn',{\n  mode:'myOperation',\n  foo:'foo',\n  bar:'bar'\n});\n```\n\nWe can use the properties `foo` and `bar` supplied by `config`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatiasvlevi%2Fcsvdn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatiasvlevi%2Fcsvdn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatiasvlevi%2Fcsvdn/lists"}