Я хочу переименовать некоторую строку в моем выходном DataFrame, но я не знаю как.
Здесь вы можете увидеть мой код (main.py):
import os
os.getcwd()
import pandas as pd
import loaddata as ld
import symmetryvalues as sv
import numpy as np
#%% Laden der Daten für Symmetriewerte
dataListStep = ld.loadData("../data/mpi/onlycsv/StepData")
indexStepData = 1
stepData = dataListStep[indexStepData]
resultsPerRowRatio = list()
leftMean = np.asarray([stepData.iloc[:, i].mean() for i in range(0, 5)])
rightMean = np.asarray([stepData.iloc[:, i].mean() for i in range(5, 10)])
#%% Calculation of the Mean Values of the columns
dataFrameStepLeftMean = pd.DataFrame({'leftMean': leftMean})
dataFrameStepRightMean = pd.DataFrame({'rightMean': rightMean})
symRatio = sv.symmetryRatio(dataFrameStepLeftMean.leftMean, dataFrameStepRightMean.rightMean)
print("Das Ergebnis Symmetry Ratio über die Mittelwerte lautet: " +str(symRatio))
#%% Line Scan
for i in range(len(stepData)):
stepDataLeft = stepData.to_numpy()[i, 0:5]
stepDataRight = stepData.to_numpy()[i, 5:10]
dataFrameOfStepDataLeft = pd.DataFrame({'stepDataLeft': stepDataLeft})
dataFrameOfStepDataRight = pd.DataFrame({'stepDataRight': stepDataRight})
resultsPerRowRatio.append(sv.symmetryRatio(dataFrameOfStepDataLeft.stepDataLeft, dataFrameOfStepDataRight.stepDataRight))
print("Das Ergebnis der Einzelnen Schritte über Symmetry Ratio ist:" +str(resultsPerRowRatio))
и другой (symbryvalues.py):
def symmetryRatio(L, R):
result = L/R
return result
Это мой вывод :
The result of Symmetry Ratio over the mean values is: 0 0.833333
1 0.888889
2 1.294118
3 1.000000
4 1.445026
dtype: float64
The result of the individual steps over Symmetry Ratio is:[0 0.833333
1 0.888889
2 1.333333
3 1.000000
4 1.470588
dtype: float64, 0 0.846154
1 0.894737
2 1.250000
3 1.000000
4 1.404762
dtype: float64, 0 0.818182
1 0.900000
2 1.285714
3 1.000000
4 1.428571
dtype: float64, 0 0.840000
1 0.875000
2 1.333333
3 1.000000
4 1.500000
dtype: float64, 0 0.826087
1 0.882353
2 1.285714
3 1.000000
4 1.428571
dtype: float64]
Это мои тестовые данные csv:
"" ""
1.00,0.80,0.40,0.20,0.50,1.20,0.90,0.30,0.20 , 0,34
1,10,0,85,0.50,0.21,0.59,1.30,0.95,0.40,0.21,0.95
0.90,0.90,0.45,0.23,0.50,1.10,1.00,0.35,0.23 , 0,35
1,05,0.70,0.40,0.28,0.57,1.25,0.80,0.30,0.28,0.38
0,95,0.75,0.45,0.30,0.60,1.15,0.85,0.35,0.30 , 0,42
"" ""
Но теперь я хочу получить такой вывод:
The result of Symmetry Ratio over the mean values is:
Stride Length Ratio 0.833333
Stand Duration Ratio 0.888889
Swing Duration Ratio 1.294118
Douple Support Time Ratio 1.000000
Relation Swing Stand Ratio 1.445026
dtype: float64
The result of the individual steps over Symmetry Ratio is:
[ First Step:
Stride Length Ratio 0.833333
Stand Duration Ratio 0.888889
Swing Duration Ratio 1.333333
Douple Support Time Ratio 1.000000
Relation Swing Stand Ratio 1.470588
dtype: float64,
Second Step:
Stride Length Ratio 0.846154
Stand Duration Ratio 0.894737
Swing Duration Ratio 1.250000
Douple Support Time Ratio 1.000000
Relation Swing Stand Ratio 1.404762
dtype: float64,
Third Step:
Stride Length Ratio 0.818182
Stand Duration Ratio 0.900000
Swing Duration Ratio 1.285714
Douple Support Time Ratio 1.000000
Relation Swing Stand Ratio 1.428571
dtype: float64,
Fourth step:
Stride Length Ratio 0.840000
Stand Duration Ratio 0.875000
Swing Duration Ratio 1.333333
Douple Support Time Ratio 1.000000
Relation Swing Stand Ratio 1.500000
dtype: float64,
Fifth step:
Stride Length Ratio 0.826087
Stand Duration Ratio 0.882353
Swing Duration Ratio 1.285714
Douple Support Time Ratio 1.000000
Relation Swing Stand Ratio 1.428571
dtype: float64]
Как мне этого достичь? Спасибо за помощь.