All Questions
44 questions
0
votes
1
answer
54
views
Merge pandas dataframes on duplicate keys with certain conditions on other columns
As the title suggests, I want to combine two Pandas datasets where both has duplicate keys but also considering a certain condition on other columns (in this case the date columns). I have these two ...
1
vote
2
answers
75
views
Nearest date between 2 column dates, generate new column
I have this toydataset:
df = pd.DataFrame({'user':[1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,4],
'd1':['1995-09-01','1995-09-02','1995-10-03','1995-10-04','1995-10-05','1995-11-07','1995-11-08','...
0
votes
1
answer
26
views
How to create dataframe of conflicting shifts in Pandas?
I have two dataframes:
filled_shifts:
Worker ID Position Name Start Date Start Time End Date End Time
0 00ul13zkpiYemBsW10x7 Remote CC - Tasks 2020-07-27 5:00:00 ...
1
vote
3
answers
144
views
Cannot use pandas.merge_asof with multiple columns
I am trying to merge two pandas dataframes each consisting two string columns and one date column.
df1
a b date
100 200 2022-01-03
100 200 2022-01-04
101 200 2022-01-05
101 200 ...
5
votes
1
answer
230
views
in Python, get "merge as of" to match multiple (and possibly repetitive) rows of one dataframe to rows of another dataframe based on range of dates
I have two data frames and I want to merge them based on dates. I want any rows df2 to match with rows of df1 on the condition that the date on df2 entry is within the 5-year-prior window of the date ...
0
votes
1
answer
37
views
How to merge data with same data in pandas? [duplicate]
i have this following data:
Date_reported Country_code Country WHO_region New_cases Cumulative_cases New_deaths Cumulative_deaths
0 2020-01-03 AF Afghanistan EMRO 0 0 0 0
1 2020-01-04 ...
2
votes
1
answer
78
views
Merge dataframes by comparing the date, Pandas
I have two dataframes, and I want to merge them by comparing the date on different columns.
This is the dataframe with the work unit and date listed. Cum work denotes the number of jobs completed by ...
0
votes
1
answer
140
views
comparing two dataframes on the same date range python
I have two dataframes and I want to compare df2 with df1 in order to show the "id_number missing" that are not in df1 but are in df2.
I have a script where I end up with more missing values ...
1
vote
1
answer
56
views
Multiple column closest date match pandas
I have two dataframes as such:
df_a = pd.DataFrame({"col_a": ["a", "a", "b", "b"], "date_a": ["2019-01-03", "2019-02-04",...
1
vote
1
answer
131
views
Pandas dates - pairing Mondays with other days from the same week
I have a dataframe full of Mondays or Tuesdays as dates and another dataframe full of Mondays, Tuesdays and Wednesdays. I'd like to match each of the dates in the second dataframe with the Monday or ...
0
votes
1
answer
173
views
Calculating a sum based on the date from another table
I have the following data frames:
A list of client invoices.
Client
NetTotal
Issued
A
1000
01/01/2021
A
2500
03/01/2021
B
1500
05/01/2021
B
2000
07/01/2021
A list of the same clients and dates of ...
0
votes
1
answer
367
views
Pandas: Sum and aggregate by daily amounts after multiplying exchange rates look-up by same dates from another dataframe
thank you in advance for your help.
I am completely new to Python, and I tried different things to achieve what is required (mostly using groupby()) but everything has failed so far.
I have a data ...
0
votes
1
answer
139
views
Merge 2 Dataframes with Unequal Dates of Year, Month, Day, Hour
I have been searching how to merge 2 dataframes with unequal dates. Each date column are integer data types in year, month, day, hour columns. Suppose the df1 looks like this:
site data1 ...
0
votes
1
answer
21
views
Combining 2 Unequal Length Date Pandas
i have 2 unequal length pandas that I am trying to combine based on their matching hour, month, year, and plant_name. I'm not sure whether merge/concat/join is most efficient or uses less memory since ...
0
votes
0
answers
386
views
Merge specific csv columns of one csv with another csv based on two common columns in Python
I want to merge two csv files. However I want to select few columns of one csv file and merge it with another csv. My csv's are as follow
one.csv
Id,StationName,Date,Time,Temperature
1,Abc,01-01-2019,...