[英]How to print a range of records from a csv file in python
list_input = input("please enter a date in the format mm/dd/yyyy")
df = pd.read_csv("covid_19_data.csv")
index = df.index
new_val = df["ObservationDate"] == list_input
b = index[new_val]
new_output = b.tolist()
new_list = [x + 1 for x in new_output]
So that is my code for finding what records have a certain date that the user inputted, how do I now print all those records with the same date using the list I have created that holds all the indices这就是我用于查找哪些记录具有用户输入的特定日期的代码,我现在如何使用我创建的包含所有索引的列表打印所有具有相同日期的记录
for record in new_list:
print(record)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.