question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a feature for inserting a column

See original GitHub issue

It would be really useful if there was a method that could insert a column into an existing Dataframe between two existing columns. I know about .addColumn, but that seems to place the new column at the end of the Dataframe.

For example:

df.print()

A | B 
======
7 | 5
3 | 6

df.insert({ “afterColumn”: “A”, “newColumnName”: “C”, “data”: [4,1], inplace: true }) df.print()

A | C | B 
==========
7 | 4 | 5
3 | 1 | 6

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
steveonicommented, Dec 27, 2021

Yeah sure. I’m aware of that

0reactions
risenWcommented, Dec 27, 2021

@risenW okay i get. thats cool.

but i don’t get what you trying to do here

//Using the position, you can directly splice the data array as well. 
let new_data = [...this.data] //only do this copy if the operation is happening in place, else use splice directly
new_data.splice(new_col_position, 0, [4, 1]); //Add the new data in that position.

but i will go with the example i have before, which is similar to the example you gave

Splice by default will mutate the array, so I’m saying that you should make a copy first.

Read more comments on GitHub >

github_iconTop Results From Across the Web

13 Ways to Insert a Column in Microsoft Excel
Select multiple adjacent columns by clicking on the first column heading then holding the Shift key and clicking on the last column. Right-click...
Read more >
5 ways to insert new columns in Excel - Ablebits
1. To insert a column, you need to select the necessary one and right click on it. 2. Then pick Insert -> Table...
Read more >
5 Ways to Insert New Columns in Excel (including Shortcut ...
Insert a New Column (Keyboard Shortcut) · Select a cell in the column to the left of which you want to add a...
Read more >
How to Insert Column in Excel - YouTube
If you find it hard to figure out how to insert a column into an Excel table, you're in the right place! After...
Read more >
How to Add a Column in Excel: Full Guide with Shortcuts
1. Right-click on a column. 2. Click Insert. You can also right-click on the cell or do it from the ribbon menu. Read...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found