Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
49 views

dataframes list concatenation/merging introduces nan values

I have these dataframes: import pandas as pd import numpy as np from functools import reduce a = pd.DataFrame({'id':[1, 2, 3, 4, 5], 'gr_code': [121, 121, 134, 155, 156], 'A_val': [...
George's user avatar
  • 5,711
0 votes
0 answers
15 views

How to concatenate last quarter files in a folder using python

I'm trying to merge last quarter file in a directory using python .I have tried using pandas to merge it but it is not possible to use it.
Aparna Yadav's user avatar
2 votes
1 answer
43 views

Python Update two dataframes with identical columns and a few differing rows

I am joining two data frames that have the same columns. I wanted to update the first dataframe. However, the my code creates additional columns but it is not updating. My code: left = pd.DataFrame({&...
Mainland's user avatar
  • 4,624
1 vote
2 answers
71 views

Merge over 50% of matched two df lists of list strings in pandas

I have two df: df1 = pd.DataFrame({'name1': ['ID1', 'ID2','ID3','ID4','ID5','ID6','ID7'], 'col1': ["S3,S22,S44", "S133,S32,S334", "S13,S24,S45", "S1,S2,S4,S5", "S3,S4,S5", "S3,S2,S5", "S38,S42,S9"],'...
rajiv's user avatar
  • 159
0 votes
2 answers
105 views

Combine text from multiple rows in pandas

I want to merge content for respective rows' data only where some specific conditions are met. Here is the test dataframe I am working on Date Desc Debit Credit Bal 0 04-08-2019 ...
abhi1610's user avatar
  • 743
0 votes
1 answer
75 views

Concatenate two data frames with the same name from different directories via Python

I have two folders in different directories that contain excel files with the same name. I need to concatenate the excel files, not sheets, because each file has one sheet, that have the same name. ...
newbie's user avatar
  • 644
1 vote
0 answers
50 views

How to combine dataframes

I have 2 data frames(final_combine_df & acs_df) that have a shared column ('CBG'). Dataframe acs_df has 2 additional columns that I want to add to the combined dataframe (acs_total_persons & ...
gwydion93's user avatar
  • 1,923
0 votes
0 answers
110 views

How to merge multiple text file located in two different folders and create a new column in the combine file in python?

All, I have two folders that contains ~1000 txt files. Say Folder 1 and Folder 2. I would like to combine all the files in one txt file and create a new column call "Label" and assign labels such ...
biggboss2019's user avatar
6 votes
5 answers
20k views

Concatenating two dfs in Pandas

I wanted to know if there was a way to verify if a value in one df that was being Concatenated with another existed in both dfs or the other df as well prior to stacking them on top of each other?? I ...
Chris90's user avatar
  • 1,998
-1 votes
2 answers
58 views

Merge tuple with multiple item python

I need my script to merge tuples with multiple items. I have: list = [('France', 'Euro', 'Paris'), ('France', 'Euro', 'Marseille'), ('Allemagne', 'Euro', 'Berlin'), ('Allemagne', 'Euro', 'Hambourg'),...
sapiron's user avatar
  • 93
0 votes
4 answers
241 views

Pandas dataframe merge by function on column names

I say to dataframes. df_A has columns A__a, B__b, C. (shape 5,3) df_B has columns A_a, B_b, D. (shape 4,3) How can I unify them (without having to iterate over all columns) to get one df with ...
Cranjis's user avatar
  • 2,010
2 votes
1 answer
34 views

Applying function on merge

I have two dataframes. Snippets are pasted below Employee Project Both the dataframes have common columns "Level" and "skill" on which i need to merge the "EmployeeID" column of Employee dataframe ...
Biswa's user avatar
  • 445
3 votes
2 answers
585 views

Python - Merge two lists with a simultaneous concatenation

ListA = [1,2,3] ListB = [10,20,30] I want to add the contents of the lists together (1+10,2+20,3+30) creating the following list: ListC = [11,22,33] Is there a function that merges lists specifically ...
Phoenix's user avatar
  • 4,656