样本数据:
| | Status | Failed | In Progress | Passed | Untested |
|---|-------------------------|--------|-------------|--------|----------|
| 2 | P0 Dry Run - 13/02/18 | 2.0 | | 143.0 | 5.0 |
| 3 | P1 Test Plan - 06/02/18 | 4.0 | | 247.0 | 367.0 |
| 4 | P2 Test plan - 03/01/18 | 22.0 | 2.0 | 496.0 | 54.0 |
代码:
msft = pd.read_csv("C:\\Users\\gomathis\\Downloads\\week_071.csv")
msft = msft[['Passed', 'Failed', 'Blocked', 'In Progress', 'Not_Implemented', 'Not Applicable', 'Clarification Opened', 'Untested']]
msft.to_csv("C:\\Users\\gomathis\\Downloads\\week_072.csv")
错误:
KeyError: "['Blocked'] not in index"
预期结果:
我需要一个现在可能不可用但将来可能会出现的列的例外。因此,请帮助我解决此问题。