All Questions
3,714 questions
0
votes
0
answers
27
views
Equivalent to vlookup between two pandas python, with different sets of keys [duplicate]
I have a first table (table1) which is structured as follows:
transaction
traded
ccy
First
-5
AUD
Second
21
USD
Third
14
USD
and a second one which looks like this one below (table2), where to each ...
2
votes
1
answer
98
views
Improve pandas merge performance with one large dataframe
I have two dataframe df_X and df_Y, and I want to merge these two (df_X has 1000 rows) with merge (how='inner'), everything is fine when df_Y has 1000 rows but it is very slow with big dataframe (...
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 ...
1
vote
2
answers
88
views
How do I combine rows from a table so repeated fields are ignored?
Our HR database lists individual assignments for each employee. Employees can have multiple assignments (ie. work in multiple departments or locations), or multiple roles (concurrent temporary ...
0
votes
2
answers
57
views
Pandas: Merging two dataFrames with repeated values in the merging column [duplicate]
I would like to merge two DataFrames that contain repeated records in the merging column. Here's an example:
Sample DataFrames:
import pandas as pd
import numpy as np
# Sample data for df1 and df2
df1 ...
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
0
answers
27
views
Merge 1 column against the range of 2 columns in another pandas dataframe [duplicate]
I have the scenario where I need to merge the distance in 1 dataframe against the range (upper, lower) in another.
Note, I will need to merge along with other columns also.
Complete merge (courseId , ...
0
votes
0
answers
14
views
merge rows based on first column and concatenate all other columns with comma delimiter [duplicate]
df0:
CC AN
0 67562 EPC9999A
1 67562 EPC9999B
2 67994 EPXFXXXA
3 67995 EPXFXXXS
Desired Result:
...
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
62
views
Join dataframes by a column with repeated values [duplicate]
There are two tables df1 and df2. df1 columns are id, predicted_date, df2 columns are id and actual_date.
df1 = pd.DataFrame({
'id': ['1', '1', '1', '2', '2', '2', '3', '3'],
...
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, ...
0
votes
2
answers
66
views
Python merge or concat multiple dfs with intersecting datetime index
Using Pandas can you merge multiple dataframes with a timestamp column and common columns (in this case) station, longitude, latitude and a multiple variable columns in separate files But not ...
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 ...