I have a dictionary like this: > { "Country1": {"time": [1/22/20, 1/23/20…], "cases":[0,10,20,…]}, > "Country2": {"time": [1/22/20, 1/23/20…], "cases":[0,10,20,…]}, > …. } I want to drop the dates higher than a given date and their respective cases. I’ve tried with this, but it fails because of IndexError: list index out of range. How would yo ..
Category : date
I would like to calculate the mean periode duration for the occurrence of different events. I got data where every event has an id and is tracked in a single line identified by its id. every time an event occurs the date of occurrence is saved. df_starting_point = pd.DataFrame( [{‘id’: 3, ‘0’: pd.to_datetime(‘2020-11-23T00:00:00.000000000’) , ‘1’: ..
Currently I generate this data and use it to get billing cycle ID: Cycle always start at day x of every month and x currently equal to 1 ID | StartDate | EndDate 1 | 2006/01/01| 2006/01/31 2 | 2006/02/01| 2006/02/28 3 | 2006/03/01| 2006/03/31 4 | 2006/04/01| 2006/04/30 5 | 2006/05/01| 2006/05/31 … So ..
I have multiple .csv files in the same directory called Original and I want to sort all these files per date, descending (the oldest first) – second column. Every file should be sorted and overwrite the original file. Is it possible? If not, then saved in another directory called Sorted. Can somebody help me? Original ..

So I have a dataframe with a column of cities, one numerical column (hospitalized), and a date column. I need to sum all the hospitalized according to date and the issue is that this hospitalized column gives me the acumulated number. Ex: In this portion I have 1083 hospitalized on April 6th, and 1116 on ..
for two separate dates I could use the solution in this link Count number of days between dates, ignoring weekends but what if I have columns of dates? how do I get the difference in that case? assuming these are the two columns. idx = pd.date_range(‘2020-01-01′,periods=26,freq=’D’) idx2 = pd.date_range(‘2020-02-01′,periods=26,freq=’D’) Source: Python..
This is a homework assignment. I am not allowed to use libraries etc. The purpose is to learn and understand nested lists, loops and filtering by conditionals in Python. I have a nested list of data, a short extract is below. It is 200 lines long. patients = [ [‘Milos’, ‘Jones’, ’15/01/20′, ‘male’, ‘smoker’, ‘210’], ..
I have a list of 20,000 timestamps in a pandas dataframe. Is there a function where I can convert them to the corresponding weekday? I have it such that if i do df[‘date’], all the time stamps populate. Source: Python..
I am using two functions to filter out some values such as remove null values. The functions seems to work fine but at some point there is an issue in converting a column to a date type. It works but not entirely. Here, i am passing first function value to second functions as the second ..
I have a dataframe like: data = {‘year’: [2020, 2020, 2021, 2021], ‘week’: [52, 53, 1, 2]} df = pd.DataFrame(data=data) year week 0 2020 52 1 2020 53 2 2021 1 3 2021 2 and I would like to get for each line the Monday (date) of that period so something like: year week period ..
Recent Comments