In [1]:
import numpy as np
import pandas as pd
In [2]:
parm=np.array(['Blood Pressure','Blood Pressure','Blood Pressure','Sick','Sick','Happy'])
val=np.array(["high","high",'low','No','No','Yes'])
df=pd.DataFrame([parm,val]).T
df.columns=['Parm','Value']
df
Out[2]:
Parm | Value | |
---|---|---|
0 | Blood Pressure | high |
1 | Blood Pressure | high |
2 | Blood Pressure | low |
3 | Sick | No |
4 | Sick | No |
5 | Happy | Yes |
In [4]:
# Checking data types
df['Concatenated_String']=df['Parm'] + "_" + df['Value']
df
Out[4]:
Parm | Value | Concatenated_String | |
---|---|---|---|
0 | Blood Pressure | high | Blood Pressure_high |
1 | Blood Pressure | high | Blood Pressure_high |
2 | Blood Pressure | low | Blood Pressure_low |
3 | Sick | No | Sick_No |
4 | Sick | No | Sick_No |
5 | Happy | Yes | Happy_Yes |
No comments:
Post a Comment