Pandas notes
Some notes/code snippet related to pandas operations.
Apply a function with multiple arguments to pandas DataFrame columns - using DataFrame.apply()
DataFrame.apply()
applies a function along an axis of the DataFrame.
Following is the syntax:
Use args=(param1, param2, )
parameter in DataFrame.apply()
method to pass additional arguments to a function.
It takes function parameters in a tuple. The first argument is series by default so you don't need to pass it.
Example: Convert an ISO date/DateTime stamp (2021-04-12T07:21:00.345344
) to standard
(2021-04-10 07:21:00.345344
) format.
apply_test.py
Output:
Last updated