• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Fix the following error: ValueError: cannot set using a multi-index selection indexer with a different length

Resolved: Fix the following error: ValueError: cannot set using a multi-index selection indexer with a different length

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I want to update the values from a column in a dataframe with the values from the same column but from a different row.
I tried the following code:
The expected output after the code execution would be:
How can I solve it?

Answer:

The issue is that you consider the replacement value as a vector while it is a scalar. (If it was really a vector you would need to define how to map the values)
You can use:
output:

If you have better answer, please add a comment about this, thank you!

dataframe pandas python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How can I copy files using the ansible.builtin.copy module and avoid conflicting file names?

26/03/2023

Resolved: Reshape tensors of unknown shape with tf.function

26/03/2023

Resolved: Use Svelte Component as Slot

26/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.