My question is related to this question:
CodePudding user response:
You could use concat for the nested DataFrame
nested_df = df.apply(lambda x: get_taxes_from_api(x["State"],x["Annual Salary"]),axis=1)
result = pd.DataFrame()
for element in nested_df:
result = pd.concat([result,element])
result:
print(result)
| State | annual.fica.amount | annual.federal.amount | annual.state.amount | |
|---|---|---|---|---|
| 0 | New York | 8899 | 39847 | 6375 |
| 1 | New York | 141725 | 172673 | 139201 |
| 0 | New Hampshire | 8623 | 38611 | 6177 |
| 1 | New Hampshire | 137327 | 167315 | 134881 |
| 0 | California | 8534 | 38216 | 6114 |
| 1 | California | 135922 | 165604 | 133502 |
| 0 | Vermont | 8147 | 36479 | 5836 |
| 1 | Vermont | 129746 | 158078 | 127435 |
| 0 | Idaho | 8040 | 36003 | 5760 |
| 1 | Idaho | 128051 | 156014 | 125771 |

