擅长:python、mysql、java
<p>您可以按出生日期和母亲对数据进行分组,然后计算父列中不同值的数目。将对每组DOB和Dam计算结果。您将对结果大于1的所有组感兴趣。你知道吗</p>
<pre><code>import pandas as pd
data.groupby(by=['DOB','Dam']).\ # Group your data by 'DOB' and 'Dam'
aggregate({'Sire':pd.Series.nunique}).\ # Count distinct values for 'Sire' in each group
sort_values(by="Sire", ascending= False).\ # Descending order of the results
query("Sire > 1").\ # Take the 'DOB' and 'Dam' pairs with more than 1 'Sire'
to_excel("File_with_results.xlsx") # Write the results to an excel file
</code></pre>