运行结果总是显示:'float' object cannot be interpreted as an integer

图片说明

代码如下:

```import numpy as np

import pandas as pd

import scipy.fftpack as sf

data=pd.read_csv('Calculator Expressions Plot 6.csv')

Fr=data['fr2'].values.reshape(121.1001)

A=abs(sf.fft2(Fr))

x,y=A.shape

B=A/x/y*2

B[0,0]/2

shift_B=sf.fftshift(B,axes=1)

if y%2==0:

N=y/2

else:

N=(y+1)/2-1

p=4

space_n=10

n1=int(N-space_n)

n2=int(N+space_n)

FFT2_B=shift_B[0:13*p:p,n1:n2+1]

Y=[]

for i in range(13):

for j in range(21):

X=[j,i,FFT2_B[i,j]]

Y=Y+X

arr=np.array(Y).reshape(273,3)

AP=arr.tolist()

from pyecharts import Bar3D

bar3d = Bar3D("3D zhu zhuang tu",width=1600,height=800)

x_axis = ["-10","-9","-8","-7","-6","-5","-4","-3","-2","-1","0","1","2","3","4","5","6","7","8","9","10"]

y_axis = ["0","1f","2f","3f","4f","5f","6f","7f","8f","9f","10f","11f","12f"]

range_color = ['#313695','#4575b4','#74add1','#abd9e9','#e0f3f8','#ffffbf','#fee090','#fdae61','#f46d43','#d73027','#a50026']

bar3d.add("dian ci li fft zhu zhuang tu",x_axis,y_axis,AP,is_visualmap=True,

visual_range=[0,2500],

visual_range_color=range_color,

grid3d_width=200,

grid3d_depth=80,)

bar3d.render()

错误的位置是第六行:

data=pd.read_csv('Calculator Expressions Plot 6.csv')

Fr=data['fr2'].values.reshape(121.1001)

csv文件中数据是浮点数,data和Fr必须是整数吗?

麻烦各位前辈解答一下。

回答

Fr=data['fr2'].values.reshape(121.1001)

->

Fr=data['fr2'].values.reshape(121,1001)

是逗号

问题解决的话,请点下采纳

以上是 运行结果总是显示:'float' object cannot be interpreted as an integer 的全部内容, 来源链接: utcz.com/a/41699.html

回到顶部