OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Pandas - df.compare() how to change self/other labels?

  • Thread starter Thread starter A Clockwork Orange
  • Start date Start date
A

A Clockwork Orange

Guest
Using df.compare in Pandas, is it possible to change the labels of self/other from the output?

I need to send this output directly to less technically savvy users and would like to change them to more descriptive labels.

My code:

Code:
  if df_1.equals(df_2):
    return None
  else:
    return df_1.compare(df_2, align_axis=0)
<p>Using <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.compare.html" rel="nofollow noreferrer">df.compare</a> in Pandas, is it possible to change the labels of self/other from the output?</p>
<p>I need to send this output directly to less technically savvy users and would like to change them to more descriptive labels.</p>
<p>My code:</p>
<pre><code> if df_1.equals(df_2):
return None
else:
return df_1.compare(df_2, align_axis=0)
</code></pre>
 

Latest posts

M
Replies
0
Views
1
MusicLovingIndianGirl
M
Q
Replies
0
Views
1
quora question
Q
Top