Skip to content

Instantly share code, notes, and snippets.

@ryanorsinger
Created October 18, 2019 14:29
Show Gist options
  • Save ryanorsinger/28a5af45a37a0f3a718e1008128fe833 to your computer and use it in GitHub Desktop.
Save ryanorsinger/28a5af45a37a0f3a718e1008128fe833 to your computer and use it in GitHub Desktop.
Now We Know - Rolling Log of Lessons Learned

"ValueError: Length of passed values is 20, index implies 1"

The error message of "ValueError: Length of passed values is 20, index implies 1" most likely comes from comparing a numpy array to a pandas series. Fix: Make both variables the same data type, so they are both a numpy array or they are both a pandas series.

Steps to reproduce:

import numpy as np
import pandas as pd

x = np.array([1, 2, 3, 4, 5])
y = pd.Series([2])

x - y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment