小编Ada*_*dam的帖子

平均数据箱中的数据

我有两个列表:1是深度列表,另一个是叶绿素列表,它们彼此对应.我希望每0.5米深度平均一次叶绿素数据.

chl  = [0.4,0.1,0.04,0.05,0.4,0.2,0.6,0.09,0.23,0.43,0.65,0.22,0.12,0.2,0.33]
depth = [0.1,0.3,0.31,0.44,0.49,1.1,1.145,1.33,1.49,1.53,1.67,1.79,1.87,2.1,2.3]
Run Code Online (Sandbox Code Playgroud)

深度箱的长度并不总是相等,并且不总是以0.0或0.5的间隔开始.叶绿素数据总是与深度数据协调.叶绿素平均值也不能按升序排列,需要根据深度保持正确的顺序.深度和叶绿素列表很长,所以我不能单独这样做.

我如何制作0.5米深度的垃圾箱,其中平均含有叶绿素数据?

目标:

depth = [0.5,1.0,1.5,2.0,2.5]
chlorophyll = [avg1,avg2,avg3,avg4,avg5]
Run Code Online (Sandbox Code Playgroud)

例如:

avg1 = np.mean(0.4,0.1,0.04,0.05,0.4)
Run Code Online (Sandbox Code Playgroud)

python numpy average scientific-computing python-3.x

5
推荐指数
2
解决办法
954
查看次数

如何从代码中删除RunTimeWarning错误?

RuntimeWarning当我在最底层运行回归代码时,我不断得到.我不知道如何修复它们.我相信它可能是attencoef列表,因为它有一些nan值.有什么建议?

这些是我得到的错误:

C:\Users\MTM User\Anaconda3\lib\site-packages\scipy\stats\_stats_mstats_common.py:106: RuntimeWarning: invalid value encountered in double_scalars
  slope = r_num / ssxm
C:\Users\MTM User\Anaconda3\lib\site-packages\scipy\stats\_stats_mstats_common.py:116: RuntimeWarning: invalid value encountered in sqrt
  t = r * np.sqrt(df / ((1.0 - r + TINY)*(1.0 + r + TINY)))
C:\Users\MTM User\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:879: RuntimeWarning: invalid value encountered in greater
  return (self.a < x) & (x < self.b)
C:\Users\MTM User\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:879: RuntimeWarning: invalid value encountered in less
  return (self.a < x) & (x < self.b)
C:\Users\MTM User\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:1818: RuntimeWarning: invalid value …
Run Code Online (Sandbox Code Playgroud)

python numpy compiler-warnings linear-regression spyder

3
推荐指数
1
解决办法
3035
查看次数