diff --git a/examples/scripts/approximation_methods.py b/examples/scripts/approximation_methods.py index a17fd51..732711f 100644 --- a/examples/scripts/approximation_methods.py +++ b/examples/scripts/approximation_methods.py @@ -88,31 +88,11 @@ def run_FORM_simple( iter_number = optimResult.getIterationNumber() dfResult = pd.DataFrame() - dfResult = dfResult.append( - pd.DataFrame([result.getEventProbability()], index=["Probability of failure"]) - ) - dfResult = dfResult.append( - pd.DataFrame( - [result.getGeneralisedReliabilityIndex()], - index=["Generalised reliability index"], - ) - ) - dfResult = dfResult.append( - pd.DataFrame([iter_number], index=["Number of iterations"]) - ) - dfResult = dfResult.append( - pd.DataFrame( - [result.getStandardSpaceDesignPoint()], - index=["Standard space design point"], - ) - ) - dfResult = dfResult.append( - pd.DataFrame( - [result.getPhysicalSpaceDesignPoint()], - index=["Physical space design point"], - ) - ) - + dfResult = pd.DataFrame([result.getEventProbability()], index=["Probability of failure"]) + dfResult = pd.concat([dfResult, pd.DataFrame([result.getGeneralisedReliabilityIndex()], index=["Generalised reliability index"])]) + dfResult = pd.concat([dfResult, pd.DataFrame([iter_number()], index=["Number of iterations"])]) + dfResult = pd.concat([dfResult, pd.DataFrame([result.getStandardSpaceDesignPoint()], index=["Standard space design point"])]) + dfResult = pd.concat([dfResult, pd.DataFrame([result.getPhysicalSpaceDesignPoint()], index=["Physical space design point"])]) dfResult = dfResult.reset_index() dfResult.columns = ["", "Results - FORM (" + nearestPointAlgo + ")"] pd.options.display.float_format = "{:,.2E}".format diff --git a/examples/scripts/simulation_methods.py b/examples/scripts/simulation_methods.py index 5873a69..d647b80 100644 --- a/examples/scripts/simulation_methods.py +++ b/examples/scripts/simulation_methods.py @@ -139,26 +139,10 @@ def function_intersection(X): result = simulation.getResult() - dfResult = pd.DataFrame() - dfResult = dfResult.append( - pd.DataFrame( - [result.getProbabilityEstimate()], index=["Probability of failure"] - ) - ) - dfResult = dfResult.append( - pd.DataFrame( - [result.getCoefficientOfVariation()], index=["Coefficient of varation"], - ) - ) - dfResult = dfResult.append( - pd.DataFrame([result.getConfidenceLength()], index=["95 % Confidence length"]) - ) - dfResult = dfResult.append( - pd.DataFrame( - [result.getOuterSampling() * result.getBlockSize()], - index=["Number of calls"], - ) - ) + dfResult = pd.DataFrame([result.getProbabilityEstimate()], index=["Probability of failure"]) + dfResult = pd.concat([dfResult, pd.DataFrame([result.getCoefficientOfVariation()], index=["Coefficient of varation"])]) + dfResult = pd.concat([dfResult, pd.DataFrame([result.getConfidenceLength()], index=["95 % Confidence length"])]) + dfResult = pd.concat([dfResult, pd.DataFrame([result.getOuterSampling() * result.getBlockSize()], index=["Number of calls"])]) dfResult = dfResult.reset_index() dfResult.columns = ["", "Results - Monte Carlo"] @@ -322,26 +306,10 @@ def function_intersection(X): result = simulation.getResult() - dfResult = pd.DataFrame() - dfResult = dfResult.append( - pd.DataFrame( - [result.getProbabilityEstimate()], index=["Probability of failure"] - ) - ) - dfResult = dfResult.append( - pd.DataFrame( - [result.getCoefficientOfVariation()], index=["Coefficient of varation"], - ) - ) - dfResult = dfResult.append( - pd.DataFrame([result.getConfidenceLength()], index=["95 % Confidence length"]) - ) - dfResult = dfResult.append( - pd.DataFrame( - [result.getOuterSampling() * result.getBlockSize()], - index=["Number of calls"], - ) - ) + dfResult = pd.DataFrame([result.getProbabilityEstimate()], index=["Probability of failure"]) + dfResult = pd.concat([dfResult, pd.DataFrame([result.getCoefficientOfVariation()], index=["Coefficient of variation"])]) + dfResult = pd.concat([dfResult, pd.DataFrame([result.getConfidenceLength()], index=["95 % Confidence length"])]) + dfResult = pd.concat([dfResult, pd.DataFrame([result.getOuterSampling() * result.getBlockSize()], index=["Number of calls"])]) dfResult = dfResult.reset_index() dfResult.columns = ["", "Results - Importance Sampling"] diff --git a/requirements.txt b/requirements.txt index d65ee89..80ab225 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ pre-commit flake8 sphinx-gallery numpydoc -pandas<2.0 +pandas tqdm shapely lxml-html-clean diff --git a/requirements.yml b/requirements.yml deleted file mode 100644 index 405e886..0000000 --- a/requirements.yml +++ /dev/null @@ -1,20 +0,0 @@ -# $ conda env create --file requirements.yml -# $ conda env update --file requirements.yml -name: otbenchmark -dependencies: -- python==3.9.1 -- numpy==1.21.* -- matplotlib==3.4.2 -- scipy==1.7.* -- openturns>=1.16 -- jupyterlab==3.0.16 -- nbconvert==6.1.0 -- black==21.12b0 -- pre-commit -- flake8 -- pandas==1.3.* -- tqdm==4.61.2 -- shapely==1.7.1 -- pip: - - black-nb==0.5.0 -