首页 > 解决方案 > function() 缺少 4 个必需的位置参数

问题描述

问题显示在第 90 行。

我认为主要问题在于数据框。因此,在计算值之后,function我返回了一个数据框。该函数在 for 循环中用于生成不同的行,如下所示。

代表性情节:我一直在尝试一些线索,但仍然无法正常工作

![在此处输入图像描述][1]

import math as m
import matplotlib.pyplot as plt
import pandas as pd

#tst=529
#temp=524
#dtube=0.41

def function(ConstantA,ConstantB,tst,temp,dtube):
# variables and constants
    k0 = 38.9
    e = 90000
    lambd=-328200
    dp=0.003;roecat= 1670; porosity=0.4; cpa=95.2; cpb=32; cpc= 102.81;cpc= 71; ma=28;mb=32;mc=44;md=16; viscosity=0.25e-4;tst=tst;
    dtube=dtube;ntube=25000; ltube= 9.8288; dw=1;wplot=0; yar=0;ybr=0;np=0;pi=3.1416; areacstube= pi * (dtube ** 2) / 4; wmaxtube=ltube * areacstube * roecat;wmax=wmaxtube * ntube;
    # Initial conditions
    w=0; fc=0; fa0=0.8125; fb0=0.26;fd0=2.175;fr=0;temp=temp; p=17; fain=fr * yar+fa0; fbin=fr * ybr+fb0;fdin=fd0;

标签: pythonpandasmatplotlib

解决方案


您正在调用function(row),其中仅包含所需 5 的一个参数(即ConstantA,ConstantB,tst,temp,dtube)。

如果您想解压缩行中的每个项目,以便对应每个参数,您可以这样做function(*row)


推荐阅读