メインコンテンツへスキップ

Key error(0,0)

回答済み

コメント

3件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Matthias Miltenberger
    • Gurobi Staff

    Hi Ece,

    It seems this is rather a general Python question and not a Gurobi-specific issue. Your approach using pandas to read in the Excel sheets appears very reasonable - I don't see your problem or question, to be honest. It is always recommended to share a minimal reproducible example, so please try formulating a shorter example data set and let us know where you are stuck.

    Best regards,
    Matthias

    0
  • donier vask
    • Gurobi-versary
    • First Comment

    This annoying error means that Pandas can not find your column name in your dataframe.  Before doing anything with the data frame, use print(df.columns) to see dataframe column exist or not.

    print(df.columns)

    I was getting a similar kind of error in one of my codes. Turns out, that particular index was missing from my data frame as I had dropped the empty dataframe 2 rows. If this is the case, you can do df.reset_index(inplace=True) and the error should be resolved.

     

    0

投稿コメントは受け付けていません。