简体   繁体   English

我想在自己的值旁边打印每个 state

[英]I want to print each state next to its own value

I have dataset of covid-19 and I've used for loop to thro all states and divided total deaths & total cases and I use append to store the results and it's showing the result what I want is to print every state next to its own value我有covid-19的数据集,我已经使用for循环遍历所有州并划分总死亡人数和总病例数,我使用append来存储结果,它显示我想要的结果是打印每个state旁边价值

here is my code enter image description here这是我的代码在此处输入图像描述

You can try something like the following:您可以尝试以下方法:

s = []
for i in range(len(r)):
    value = r['tot_death'][i]/r['tot_cases'][i]
    s.append((value, r['state']))

And I agree with Reza Rahemtola, please dont upload screenshots of code, instead just give it as text.我同意 Reza Rahemtola 的观点,请不要上传代码截图,而是将其作为文本提供。

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

相关问题 我确实希望每个多处理池工作者都有自己的全局变量副本并能够修改它 - I do want each multiprocessing pool worker to have its own copy of the global variable and be able to modify it 我自己打印一个元组,但不打印其他变量 - I print a tuple on its own, but not with other variables Python:将每个 excel 行打印为自己的 ms word 页面 - Python: print each excel row as its own ms word page 我希望能够从python中找到excel中的值并在下一列中打印该值 - I want to be able to locate a value in excel from python and print the value in the next column 它没有打印我想要打印的所有内容 - Its not printing everything I want it to print 我如何编写一个函数或循环,将每个唯一值分配到它自己的可访问数据框中? - How could I write a function or loop that assigns each unique value into its own accessible dataframe? 如何将数据框列中的每个值移到其自己的列中? - How can I move each value in a data frame column into its own column? 我想在不同的行上打印每一行 - I want to print each line on a different row 在Python中将文本文件的每个值移至其各自的行 - Moving each value of a text file to its own line in Python 我应该如何将每个工作表分配给它自己的变量? - How should I assign each worksheet to its own variable?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM