All Questions
1,805 questions
1
vote
1
answer
52
views
How to merge dataframes over multiple columns and split rows?
I have two datafames:
df1 = pd.DataFrame({
'from': [0, 2, 8, 26, 35, 46],
'to': [2, 8, 26, 35, 46, 48],
'int': [2, 6, 18, 9, 11, 2]})
df2 = pd.DataFrame({
'from': [0, 2, 8, 17, 34],
...
0
votes
0
answers
32
views
Merging 3 DataFrames with a Bespoke Format [duplicate]
I am an apprentice doing my first project using Pandas so apologies if I get any terms wrong or if my question is very obvious.
I am trying to collate the information of 3 DataFrames using UniqueID as ...
0
votes
1
answer
50
views
Indices mismatch during merge in pandas
I am trying to merge two dataframes in Python, pandas, df1 and df2.
I am trying to merge them on Column1, and then assign value of Column2 from df2 to df1.
This is my code:
df1 = df1.reset_index()
...
0
votes
1
answer
30
views
The syntax of how updating more than one specified column in Python Panda dataframes during a merge whenmatched condition
I am building a StreamLit appication in Snowflake. I am using a grid editor initially loading data from a table. Users can change the data in certain columns. When the users hit a submit button I want ...
1
vote
1
answer
65
views
Pandas: Merge by common column retaining all other columns and sort by common column [duplicate]
I have two DataFrames, both of which have an x column and a y column. The x values are unique within each DataFrame, but there is some overlap between the two.
I want to merge the two DataFrames, ...
1
vote
2
answers
83
views
dataframe easily implement merge_asof
I have two dataframes:
time_start = datetime.datetime.strptime('2024-02-01 10:00:00', "%Y-%m-%d %H:%M:%S")
interval_l = [1, 7, 14, 17, 21, 22, 31]
df_l = pd.DataFrame(index = [time_start + ...
0
votes
0
answers
11
views
Look up values from single column in pandas df1 for multiple columns in df2 [duplicate]
I have two dataframes, df1 is a list of football teams and their average stats for the season df2 is a list of matches, each of which features two of the teams from df1. I want to be able to look up ...
0
votes
2
answers
75
views
how to make pandas merge without inner data
how to make pandas merge without inner data?
input:
inner_df = pd.merge(df1, df2, on='user', how='inner')
outer_df = pd.merge(df1, df2, on='user', how='outer')
so i don't need inner data i need only ...
0
votes
1
answer
34
views
Is there a smart way to merge 2 DataFrames based on substring criteria?
I'm currently working with some phones numbers DataFrames and I need to merge them in a substring criteria way and has to be an left merge (meaning to have all combinations in case there is more than ...
0
votes
2
answers
63
views
how to merge dfs without duplicate lines
My dataframes are similar to below
df1:
user name length job
0 5234 Ed 7 manager
1 4793 Mark 14 admin
2 9321 Nick 8 admin
3 8149 Duncan 3 admin
4 ...
-2
votes
1
answer
74
views
Combining data with multiple dates into one row for each case
I have a bunch of data and each row has a 4 date fields. The first date field is a duplicate for the ID number and sometimes not. It looks a little like this:
ID,LName,FName,DateIn,DateOut,Days,...
0
votes
0
answers
16
views
Merging two pandas dataframe with repeated primary keys [duplicate]
I have two pandas dataframe that looks like
df1=
Class_ID Student_ID feature1
1 4 54
1 7 24
1 9 865
2 23 342
...
-1
votes
1
answer
63
views
How do I perform a smear between two dataframes in python/pandas? [duplicate]
I have two dataframes and I need to perform a smear (if that is what it's generally called). Basically the first one is smaller (5 million rows) and the other is 40 million rows. I want to add the ...
0
votes
1
answer
39
views
I want to lookup values from pivot, if value does not found then use N using Pandas Dataframe [duplicate]
Input df
This is pivot I have.I want to lookup only zero value if there in above pivot and print N if value absent.
Expected df
In excel i am able to do comparison in these 2 df with sumif function
...
2
votes
2
answers
43
views
Merge Dataframe based on substring column labeld while keep the original columns label
I have a dataframe having columns with the a label pattern (name/startDateTime/endDateTime)
import pandas as pd
pd.DataFrame({
"[RATE] BOJ presser/2024-03-19T07:30:00Z/2024-03-19T10:30:00Z&...