简体   繁体   English

当我只需要文件中的几个数据点时,如何对非常大的 csv excel 文件中的排名值进行排名?

[英]How do I rank rank values from a very large csv excel file when I only need a few data points from the file?

I uploaded an incredibly large Excel file as such我上传了一个非常大的 Excel 文件

import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv("C:\\Users\\willi\\Downloads\\Formatted Corona Virus Data.csv")

index = ['ARG', 'BOL', 'CHL', 'COL', 'CRI', 'CUB', 'ECU', 'PAN', 'PER', 'PRY']

and it looks like the image below obviously it continues on to more countries它看起来像下面的图像显然它继续到更多国家

how do I create a list to compare and rank these 10 countries from the index for total cases from the most recent date from most to least?我如何创建一个列表来比较和排名这 10 个国家从最近日期的总病例指数从多到少?

*edit some of them may have different most recent dates *编辑其中一些可能有不同的最近日期

在此处输入图像描述

How about怎么样

df[df.iso_code.isin(index)].groupby(['index','date']).total_cases.rank() ? df[df.iso_code.isin(index)].groupby(['index','date']).total_cases.rank()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 csv 文件中的元素从最低到最高排列? - how can i rank elements in a csv file from lowest to highest? 如何从文件中检索名称的等级,然后将 output 内容放入我的打印语句中? - How do I retrieve the rank of the names from a file and then output the stuff into my print statement? 如何搜索一个非常大的 csv 文件? - How do I search through a very large csv file? 如何对数据集进行排序和排序 - How do I sort and rank the data set 在不使用熊猫的情况下,如何分析CSV数据并仅从CSV文件的某些列和行中提取某些值? - WITHOUT using Pandas, how do I analyze CSV data and only extract certain values from certain columns and rows of my CSV file? 如何从使用熊猫上传的大型CSV文件中仅打印出某些行 - How do I print out only certain rows from a large CSV file uploaded using pandas 如何在Python Pandas中按排名顺序转换点列值 - How do I convert points column values in rank order in Python Pandas 如何使用从多个.csv 文件数据集中提取的值构建数组? - Python - How do I build an array using values I pull from multiple .csv file data sets? - Python 我如何仅从 csv 文件中填充 python 中具有相同值的单元格? - how do i only populate cells that has the same values in python from a csv file? 如何对在给定数据中挑选出的功能列表进行排名,并对功能进行排名? - How do I rank a list of features that I have picked out in the given data and rank the features?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM