在Pandas Python中从Excel导入

时间:2019-03-28 15:43:04

标签: python pandas jupyter-notebook

我正在尝试从Excel文件中导入数据。我想从特定的工作表中导入,并且在该特定的工作表中仅导入某些列。 我使用的代码如下:

    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x28079f9d0 UILabel:0x104529b80'Label'.height == 21   (active)>",
    "<NSLayoutConstraint:0x2807ac0a0 UILayoutGuide:0x281d9d500'UIViewSafeAreaLayoutGuide'.bottom == UILabel:0x104529b80'Label'.bottom + 17   (active)>",
    "<NSLayoutConstraint:0x2807ac140 UILabel:0x104529b80'Label'.top == UILayoutGuide:0x281d9d500'UIViewSafeAreaLayoutGuide'.top + 18   (active)>",
    "<NSLayoutConstraint:0x2807ae490 'UIView-Encapsulated-Layout-Height' Jordy.ViewHomeHeader:0x104529790.height == 143   (active)>",
    "<NSLayoutConstraint:0x2807ac000 'UIViewSafeAreaLayoutGuide-bottom' V:[UILayoutGuide:0x281d9d500'UIViewSafeAreaLayoutGuide']-(0)-|   (active, names: '|':Jordy.ViewHomeHeader:0x104529790 )>",
    "<NSLayoutConstraint:0x28079fc50 'UIViewSafeAreaLayoutGuide-top' V:|-(0)-[UILayoutGuide:0x281d9d500'UIViewSafeAreaLayoutGuide']   (active, names: '|':Jordy.ViewHomeHeader:0x104529790 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x28079f9d0 UILabel:0x104529b80'Label'.height == 21   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

我的想法是仅导入列C0080和C0090。我只使用一个,它可以工作但也不会保留列名。 有人可以帮忙吗 谢谢

1 个答案:

答案 0 :(得分:0)

您可以尝试以下方法:

xl_file=pd.ExcelFile('C:/Users/e877780/Desktop/DEV/S2_SK_S_06_02_input.xlsx')
sheet1=xl_file.parse("S.06.02")
s2_0602 = sheet1[['C0080','C0090']]

希望有帮助