You can achieve this by using pandas library. Here's an example:
main.py353 chars14 lines
The apply function is used to apply a lambda function on each column of the dataframe. The lambda function checks for duplicated values in each column using the duplicated function of pandas. If a value is duplicated, it is replaced with nan using the mask function of pandas.
This will output the following dataframe:
main.py108 chars7 lines
As you can see, the first unique value in each column is kept and other repeated values are replaced with nan.
gistlibby LogSnag