在网上进行一些研究时,似乎没有任何简单的方式来下令使用字典。
我的解职包括一份名单,每个名字都是关键人物。
dummy_data = {
"Date":["01/24/2029","10/28/2027", "01/24/2024","03/24/2024"],
"Company Name":["Mcdonalds", "Burger King", "KFC","Popeyes"],
"File_name_location":["C/Documents/Files/invoice1.pdf", "C/Documents/Files/invoice1.pdf","C/Documents/Files/invoice1.pdf"],
}
As you see with the above I have a field called Date which list the dates in random order. I would like to get the least to greatest dates but then also ensuring the "Company Name" as well gets moved around
根据一些资料 我不得不将日期改为我发言的截止日期。
for index, result in enumerate(dummy_data["Date"]):
dummy_data["Date"][index] = datetime.strptime(dummy_data["Date"][index], "%m/%d/%Y").date()
我知道,将日期改变为非常快的日期,时间与Mlambda相距甚远,但我没有太快地问到Mlambda。
无论如何,另一个问题是,如果可能的话,我也希望把我的日期保留在紧张之中,但似乎甚至是不可能的,因为日期()以这种格式(1.024-2029)** 返回,但现在我还必须在小体中总结这一日期,否则,日期清单将带有时间目的,而不是数据说明。
我的最终目标是:
- Sort by Date and making sure "Company Name" also keeps the correct index of the above
- If possible keep the dates with the slashes if not possible then no worries.
我知道有一个有秩序的分班,但我不熟悉这一点,因为我认为,这一班像一个马拉姆比达这样的某种功能是一种参数。
- If it even matters why The reason I would like to sort by dates is because these dates are being pulled in by some invoices which I am using a PDFREADER to read the dates and then I would to ultimately merge the pdfs together but it will be merged by the date of the file meaning the file with the "least" date will be put on top or bottom depending on what I want. In any case if anyone feels like they have some sort of workaround please get back to me.
也不论出于何种原因 我确实在尝试了。
sorted_val = str(sorted(dummy_data["Date"]))
我把上述检查增加一倍,实际上没有发现任何东西。