From 8087a3f5a238e76c9ebf3bede2c3cad43867f239 Mon Sep 17 00:00:00 2001 From: Devwulf <58543895+Devwulf@users.noreply.github.com> Date: Thu, 13 Jan 2022 16:44:15 -0500 Subject: [PATCH] Added type to DataFrame.rename mapper --- src/danfojs-base/core/frame.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/danfojs-base/core/frame.ts b/src/danfojs-base/core/frame.ts index 7cdd004f..b9e575c4 100644 --- a/src/danfojs-base/core/frame.ts +++ b/src/danfojs-base/core/frame.ts @@ -2754,14 +2754,18 @@ export default class DataFrame extends NDframe implements DataFrameInterface { * */ rename( - mapper: any, + mapper: { + [index: string | number]: string | number + }, options?: { axis?: 0 | 1 inplace?: boolean } ): DataFrame - rename( - mapper: any, + rename( + mapper: { + [index: string | number]: string | number + }, options?: { axis?: 0 | 1 inplace?: boolean @@ -2777,8 +2781,9 @@ export default class DataFrame extends NDframe implements DataFrameInterface { const colsAdded: string[] = []; const newColumns = this.columns.map(col => { if (mapper[col] !== undefined) { - colsAdded.push(mapper[col]); - return mapper[col] + const newCol = `${mapper[col]}`; + colsAdded.push(newCol); + return newCol; } else { return col }