我有一个形状为(t,l,b)=(122,40,30)的3D数组(TAU),我想将其作为2D导出到Excel工作簿中,第三个维度是工作表数。因此,基本上,结果将是30张纸,每张纸具有122行40列的表格。它需要三个for
循环(t,l和b)来形成此数组,最后我得到了最终结果,然后尝试将其导出到Excel工作簿中。
我是Python的新手,似乎语法有问题。我在用熊猫。
这是代码中似乎引起错误的部分。请注意,TAU创建为
TAU=np.zeros(len(t),40,30)
writer = pd.ExcelWriter((stn + '_AOD.xlsx'), engine='xlsxwriter')
Time = pd.DataFrame(t)
for i in range(0, 40):
TAU = pd.DataFrame(nc.variables['TAU'][:,i,:])
Time.to_excel(writer, index=False, header=['DateTime'], sheet_name='bin%d' % i)
TAU.to_excel(writer, index=False,header=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], sheet_name='bin%d' % i, startcol=1)
writer.save()
np.close()
错误: TAU = pd.DataFrame(nc.variables ['TAU'] [:, i,:])
KeyError:'TAU'
Exception ignored in: <bound method Workbook.__del__ of
<xlsxwriter.workbook.Workbook object at 0x0000000007D3EFD0>> Traceback
(most recent call last): File
"C:\ProgramData\Anaconda3\lib\site-packages\xlsxwriter\workbook.py",
line 149, in __del__ Exception: Exception caught in workbook
destructor. Explicit close() may be required for workbook.
答案 0 :(得分:0)
下面的代码产生我认为您正在寻找的输出。
$('.menu-container').scroll(function() {
var menuContainerScrollVal = $(".menu-container").scrollLeft();
$(".menu > ul > .page_item_has_children >.children").css("margin-left", -menuContainerScrollVal);
});