why do i get an error in my code?

load("stormData");
stormData.Property_Cost(ismissing(stormData.Property_Cost))=0;
stormData.Crop_Cost(ismissing(stormData.Crop_Cost))=0;
stormData.Total_Cost(ismissing(stormData.Total_Cost))=0;
summaryRegionCosts= groupsummary(stormData, "Region", ["min", "median", "mean", "max"], "Total_Cost")
stormDataPos= stormData(stormData.Total_Cost > 0, :)
summaryRegionPosCosts= groupsummary(stormDataPos, ["min", "median", "mean", "max"], "Total_Cost")

답변 (2개)

VBBV
VBBV 2022년 12월 15일

1 개 추천

TT = load("stormData");
Load the data into variable nd use it in groupsummary
summaryRegionCosts= groupsummary(TT, "Region", ["min", "median", "mean", "max"], "Total_Cost")

댓글 수: 4

Emem
Emem 2022년 12월 15일
이동: VBBV 2022년 12월 16일
load("stormData");
stormData.Property_Cost(ismissing(stormData.Property_Cost))=0;
stormData.Crop_Cost(ismissing(stormData.Crop_Cost))=0;
stormData.Total_Cost(ismissing(stormData.Total_Cost))=0;
summaryRegionCosts= groupsummary(stormData, "Region", ["min", "median", "mean", "max"], "Total_Cost")
stormDataPos= stormData(stormData.Total_Cost > 0, :)
idx= find(stormData.Total_Cost > 0)
postVals= stormData.Total_Cost (idx)
summaryRegionPosCosts= groupsummary(postVals, "Region", ["min", "median", "mean", "max"], "Total_Cost")
%% a new code i wrote but it is still generating an error message
VBBV
VBBV 2022년 12월 15일
이동: VBBV 2022년 12월 16일
if you load the data, do you view it as table array or numeric array ?
load("stormData");
groupsummary takes table or timetable data only as input source
Emem
Emem 2022년 12월 16일
이동: VBBV 2022년 12월 16일
I view it as a table error and attached is the error message i keep getting.
Emem
Emem 2022년 12월 16일
Unfortunately, i am unable to load the data into variable and use it in groupsummary.
load("stormData"); is uneditable in Mathworks external tool.

댓글을 달려면 로그인하십시오.

Walter Roberson
Walter Roberson 2022년 12월 16일
이동: Walter Roberson 2022년 12월 16일

1 개 추천

  • before all of this your MATLAB path might be very messed up
  • you might have a variable named "path" in your mat file that is messing everything up (but the message would be different for this case I think)
  • most likely case: either before this you assign to a variable named "find" or else you are loading a variable named "find". The error message is completely compatible with the possibility that you have a variable named "find" stored in the file.

카테고리

도움말 센터File Exchange에서 Data Preprocessing에 대해 자세히 알아보기

질문:

2022년 12월 15일

이동:

2022년 12월 16일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by