You can use the merge
function from pandas library to merge two series into a dataframe. To apply special function for each column, you can use apply
method and pass the function as a parameter. Here's an example:
main.py451 chars22 lines
Output:
main.py40 chars5 lines
In this example, we created two series s1
and s2
, merged them into a dataframe df
. We also defined two special functions special_function_s1
and special_function_s2
that are applied to each column of the dataframe using apply
method. The result is a new dataframe with modified columns.
gistlibby LogSnag