vendredi 9 juin 2017

Python Pandas if-statement Error

I'm having an error in if-statement and I don't know how to fix this error, I'm using Python 3.6 and Pandas for reading, writing and data analysis.

df1 = pd.read_csv("JonnyTheBoy10.csv", usecols=['ART_TIPO', 'ART_DESIG', 'PORTA', 'CP4', 'CP3', 'LOCALIDADE'])
df2 = pd.read_csv("JonnyTheBoyFull.csv", usecols=['ART_TIPO', 'ART_DESIG', 'PORTA', 'CP4', 'CP3', 'LOCALIDADE'])

    if df1["CP4"] == df2["CP4"] and df1["CP3"] == df2["CP3"]

I have this error:

Traceback (most recent call last):
  File "C:/Users/User01/Desktop/Normmm/Norm.py", line 11, in <module>
    if df1["CP4"] == df2["CP4"] and df1["CP3"] == df2["CP3"]:
  File "C:\anaconda\lib\site-packages\pandas\core\ops.py", line 818, in wrapper
    raise ValueError(msg)
ValueError: Can only compare identically-labeled Series objects

Aucun commentaire:

Enregistrer un commentaire