concat

How can I concat multiple dataframes in Python?

How can I concat multiple dataframes in Python? Question: I have multiple (more than 100) dataframes. How can I concat all of them? The problem is, that I have too many dataframes, that I can not write them manually in a list, like this: >>> cluster_1 = pd.DataFrame([[‘a’, 1], [‘b’, 2]], … columns=[‘letter ‘, ‘number’]) …

Total answers: 3

Python Pandas – Concat dataframes with different columns ignoring column names

Python Pandas – Concat dataframes with different columns ignoring column names Question: I have two pandas.DataFrames which I would like to combine into one. The dataframes have the same number of columns, in the same order, but have column headings in different languages. How can I efficiently combine these dataframes? df_ger index Datum Zahl1 Zahl2 …

Total answers: 4

Merge two dataframes by index

Merge two dataframes by index Question: I have the following dataframes: > df1 id begin conditional confidence discoveryTechnique 0 278 56 false 0.0 1 1 421 18 false 0.0 1 > df2 concept 0 A 1 B How do I merge on the indices to get: id begin conditional confidence discoveryTechnique concept 0 278 56 …

Total answers: 7

Using pandas .append within for loop

Using pandas .append within for loop Question: I am appending rows to a pandas DataFrame within a for loop, but at the end the dataframe is always empty. I don’t want to add the rows to an array and then call the DataFrame constructer, because my actual for loop handles lots of data. I also …

Total answers: 4

pandas concat ignore_index doesn't work

pandas concat ignore_index doesn't work Question: I am trying to column-bind dataframes and having issue with pandas concat, as ignore_index=True doesn’t seem to work: df1 = pd.DataFrame({‘A’: [‘A0’, ‘A1’, ‘A2’, ‘A3’], ‘B’: [‘B0’, ‘B1’, ‘B2’, ‘B3’], ‘D’: [‘D0’, ‘D1’, ‘D2’, ‘D3’]}, index=[0, 2, 3,4]) df2 = pd.DataFrame({‘A1’: [‘A4’, ‘A5’, ‘A6’, ‘A7’], ‘C’: [‘C4’, ‘C5’, ‘C6’, …

Total answers: 6

Concatenate a list of pandas dataframes together

Concatenate a list of pandas dataframes together Question: I have a list of Pandas dataframes that I would like to combine into one Pandas dataframe. I am using Python 2.7.10 and Pandas 0.16.2 I created the list of dataframes from: import pandas as pd dfs = [] sqlall = “select * from mytable” for chunk …

Total answers: 6