【发布时间】:2020-04-19 13:18:17
【问题描述】:
Scott Logistics Corp
Transportation One LLC
Brothers Logistics Inc
Western Express Inc
Dart Advantage Logistics
Western Express Inc
Western Express Inc
Landstar Inway
Circle Logistics Inc
Rightway Logistics
Rightway Logistics
Rightway Logistics
Spike Freight Service
Rightway Logistics
Rightway Logistics
AMX Logistics
T A Services Inc Formerly Team America Inc
J & R Schugel/Super Service
NFI Logistics/NFI Transportation
Titanium Trucking Services/Titanium Logistics
Patterson Companies Inc
Arrive Logistics
Cavalry Logistics Llc
Landstar Ranger Inc
Landstar Ranger Inc
Logistic Dynamics Inc/Ldi Trucking Inc
US Xpress Inc
US Xpress Inc
XPO Logistics LLC
Bedrock Logistics
Transfix Inc
Convoy Inc
Choctaw Logistics Llc
Trekker Logistics LLC
Landstar Ranger Inc
MAG Carriers Llc/Mag Transportation Llc
Capital Logistics Group LLC/Clg Transportation
Capital Logistics Group LLC/Clg Transportation
Landstar Ranger Inc
XPO Logistics LLC
以上是公司名称的数据集,其中某些名称出现在相同情况下两个大于两个。我想要一个代码来安排它们。有的公司名称出现了不止一个,但在不同的位置,如何将它们排列到一个位置? 其实我想统计哪家公司出现在数据中的次数最多。如果有其他方法可以找出出现次数最多的公司,请指教
【问题讨论】:
-
Salam Zeeshan,您能展示一下您的示例输出吗?到目前为止您尝试了什么?
-
这能回答你的问题吗? Pandas count(distinct) equivalent
-
#print All value of column for i in range(1, 1045, 1): list= (i, sheet.cell(row=i, column=9).value) def most_frequent(list): return max(set(list), key = list.count) print(most_frequent(list)) -
@Datanovice 不,我正在从 excel 文件中读取数据并使用 JupiterNotebook。
-
请使用您帖子下方的edit 链接使用您的代码更新它。
标签: python arrays python-3.x pandas list