I have the following dataframe with certain numbers of columns.
id column1 column2 column3 column4
0 X A P S
1 Y
2 Z
user has to give the input via the .txt file which contains the parameters for the new columns which has to be added to the current dataframe. the .txt file has the following content.
{
"new_case": {
"N": 2,
"concept:name": [
"column1",
"column3",
"column4"
]
}
}
The new column in the dataframe should contain the values from a mentioned column in the.txt file.
Expected output.
id column1 column2 column3 column4 new_column
0 X A P S X+P+S
1 Y Y+Nan+Nan
2 Z Z+Nan+Nan
Any help is appreciated :) Thank you.
X,Y,Zetc. strings or are they placeholder for numbers? (3) Also what's the output for summation with NaN, i.e. what the output ofZ+Nan+Nan?