Python 如何使用openpyxl和Pandas自动化代码?

Python 如何使用openpyxl和Pandas自动化代码?,python,pandas,openpyxl,Python,Pandas,Openpyxl,关于openpyxl和pandas,我有几个问题需要解决,这与数据帧DF的长度有关 第一个是关于细胞。我想自动化每一行,如果它只打印行数等于从第3行开始的数据帧长度的边框 A3 = ws['A3'] A3.border = Border(top=thin, left=thin, right=thin, bottom=thin) A3.alignment=Alignment(horizontal='general', vertical=

关于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)
第二个是关于数据帧。我想根据数据帧的长度,在df列中多次添加“None”

note =  [None, None, None,None,None,None,None,None]
df['Note'] = note

对于第二个问题,您可以简单地执行IIUC:

df['Note'] = None