I am using Jupyter and am trying to find the common data and have it tell me how many times the Bull has been in the top 3 or bottom three
LowWeaningData = {}
LowWeightData = {}
LowP8Data = {}
LowRibData = {}
LowEmaData = {}
LowImfData = {}
LowGrowthData = {}
LowWeaningData = df_bulls.nsmallest(3,['Weaning Weight(kg)'])
LowWeightData = df_bulls.nsmallest(3,['Weight (kg)'])
LowP8Data = df_bulls.nsmallest(3,['P8'])
LowRibData = df_bulls.nsmallest(3,['RIB'])
LowEmaData = df_bulls.nsmallest(3,['EMA(cm)'])
LowImfData = df_bulls.nsmallest(3,['IMF'])
LowGrowthData = df_bulls.nsmallest(3,['Growth %'])
Which prints this
This list is of the Lowest Growth % Data
Bull Sire Dam Weaning Weight(kg) Weight (kg) P8 RIB EMA(cm) \
5 S10 Black Magic L16 522.0 818 7 6 124
1 S24 P42 L11 469.0 774 7 6 116
2 S32 P41 M6 401.0 662 6 5 105
IMF Growth %
5 6.3 56.704981
1 5.6 65.031983
2 4.3 65.087282
The next part is trying to find how many times the bull appeared in the list and which ones so i use this code
lower_elements_in_all =
list(set.intersection(*map(set[LowWeaningData, LowWeightData,
LowP8Data, LowRibData, LowEmaData, LowImfData, LowGrowthData])))
I keep getting this instead of the actual bull names
['Bull', 'Sire', 'P8', 'EMA(cm)', 'RIB', 'Growth %', 'Dam', 'Weaning Weight(kg)', 'IMF', 'Weight (kg)']
How i would like my data to return is as follows
S10 has appeared 3 times in category Low Weaning Data, Low P8 Data and Low Rib Data
S24 has appeared 3 times in etc
S32 has appeared 1 times in etc
in descending order so its easy to see