Skip to content

Dataframe - Can't drop and rename #239

@Mbensler

Description

@Mbensler

Describe the bug

I am trying to read a .xlsx file, then drop three columns, and then rename the remaining columns.
If i remove the code for dropping, renaming works just fine, and if i remove the code for renaming, dropping works just fine.
HOWEVER they don't work together!

c:\Users\mbe\Documents\dev\sjr_webapp\node_modules\danfojs-node\dist\core\frame.js:1769
      delete self[name];
`(node:8272) UnhandledPromiseRejectionWarning: TypeError: Cannot delete property 'Tilstand' of [object Object]`

Renaming first and dropping second, doesn't work either.

Tilstand,Kode,Koncernkode,Driftsform,CVR,Navn,,Afdeling,Kunde ansv.,Leds. ansv.,Regnskabsafslutning
Aktiv,0005,,Personlig virksomhed,22278613,Søren's Udlejning I/S,,Padborg,Bent Martin Haugaard,Claus Thomsen,31 december
  let df = await dfd.read_excel(clientlist, { header: false });
  df.drop({
    columns: ['Koncernkode', '', 'Regnskabsafslutning'],
    axis: 1,
    inplace: true,
  });
  df.rename({
    mapper: {
      Tilstand: 'is_active',
      Kode: 'no',
      Driftsform: 'type',
      CVR: 'cvr_cpr',
      Navn: 'name',
      Afdeling: 'department',
      'Kunde ansv.': 'customer_responsible',
      'Leds. ansv.': 'management_responsible',
    },
    inplace: true,
  });
  df.print();

To Reproduce
Steps to reproduce the behavior:
Copy paste my code

Expected behavior
I expect to be able to drop columns, and then rename the remaning columns after.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions