关于openpyxl和pandas,我有几个问题需要自动化,这与数据帧DF的长度有关
第一个是关于细胞。我想自动化其中的每一行,如果它只打印行数等于从第3行开始的数据帧长度的边框
A3 = ws['A3']
A3.border = Border(top=thin, left=thin, right=thin, bottom=thin)
A3.alignment=Alignment(horizontal='general',
vertical='bottom',
text_rotation=0,
wrap_text=True,
shrink_to_fit=False,
indent=0)
A4 = ws['A4']
A4.border = Border(top=thin, left=thin, right=thin, bottom=thin)
A4.alignment=Alignment(horizontal='general',
vertical='bottom',
text_rotation=0,
wrap_text=True,
shrink_to_fit=False,
indent=0)
第二个是关于数据帧。我想根据数据帧的长度,将“None”添加到df列多次
note = [None, None, None,None,None,None,None,None]
df['Note'] = note
对于第二个问题,你可以简单地做,IIUC:
相关问题 更多 >
编程相关推荐