Split list in rows python pandas dataframe

Ahmad Ahsan Saleem

I have lists of unknown columns in python and I want to split it into rows.How I can do this.

numberArray1                  |  numberArray10                    |numberArray11 | . . .
[32.09561, 32.43092, 32.37599]| [37.015972, 37.015972, 36.889534] | [996.2953, 996.2609, 996.28845]|. . . . to N columns

This all data stores in cells of dataframe

Need to convert the horizontal value in my rows to vertical values corresponding to the respective columns.

Expected output would be.

numberArray1  numberArray10  numberArray11                    
32.09561      37.015972      996.2953
32.43092      37.015972      996.2609
32.37599      36.889534      996.28845
pyd

you can use pandas,

import pandas as pd
df=pd.read_csv("your_csv.csv")
new_df=pd.DataFrame()
for col in df.columns:
   new_df[col]=pd.DataFrame({col:pd.Series(df[col][0].str[1:-1].split(','))})

new_df is your expected dataframe

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

DataFrame Split On Rows and apply on header one column using Python Pandas

From Dev

How to split dataframe or reorder dataframe by rows in pandas

From Dev

Take long list of items and reshape into dataframe "rows" - pandas python 3

From Dev

pandas DataFrame split the column and extend the rows

From Dev

Split cell into multiple rows in pandas dataframe

From Dev

PANDAS split dataframe to multiple by unique values rows

From Dev

Pandas: split list in column into multiple rows

From Dev

Python list to pandas dataframe

From Java

Python Pandas replicate rows in dataframe

From Dev

Python Pandas Dataframe Append Rows

From Dev

Python Pandas Dataframe Append Rows

From Dev

python, pandas, dataframe, rows to columns

From Dev

Split list in Pandas dataframe column into multiple columns

From Java

Update rows in Pandas Dataframe based on the list values

From Dev

Transform rows of pandas Dataframe into list of strings

From Java

How to drop a list of rows from Pandas dataframe?

From Java

How to group dataframe rows into list in pandas groupby

From Dev

How to select a list of rows by name in Pandas dataframe?

From Dev

Selecting rows from pandas DataFrame using a list

From Dev

List Comprehension Over Pandas Dataframe Rows

From Dev

Insert rows in Pandas dataframe after comparing with list

From Dev

Inserting named rows in dataframe based on a list pandas

From Java

Split Pandas DataFrame with DatetimeIndex by na or missing rows into blocks

From Dev

Split pandas dataframe in two if it has more than 10 rows

From Dev

Split a Pandas Dataframe into multiple smaller dataframes based on empty rows

From Dev

How to loop through Pandas DataFrame and split a string into multiple rows

From Dev

Split pandas dataframe into multiple dataframes with equal numbers of rows

From Dev

Pandas: Split a dataframe rows and re-arrange column values

From Dev

split each cell in dataframe (pandas/python)

Related Related

  1. 1

    DataFrame Split On Rows and apply on header one column using Python Pandas

  2. 2

    How to split dataframe or reorder dataframe by rows in pandas

  3. 3

    Take long list of items and reshape into dataframe "rows" - pandas python 3

  4. 4

    pandas DataFrame split the column and extend the rows

  5. 5

    Split cell into multiple rows in pandas dataframe

  6. 6

    PANDAS split dataframe to multiple by unique values rows

  7. 7

    Pandas: split list in column into multiple rows

  8. 8

    Python list to pandas dataframe

  9. 9

    Python Pandas replicate rows in dataframe

  10. 10

    Python Pandas Dataframe Append Rows

  11. 11

    Python Pandas Dataframe Append Rows

  12. 12

    python, pandas, dataframe, rows to columns

  13. 13

    Split list in Pandas dataframe column into multiple columns

  14. 14

    Update rows in Pandas Dataframe based on the list values

  15. 15

    Transform rows of pandas Dataframe into list of strings

  16. 16

    How to drop a list of rows from Pandas dataframe?

  17. 17

    How to group dataframe rows into list in pandas groupby

  18. 18

    How to select a list of rows by name in Pandas dataframe?

  19. 19

    Selecting rows from pandas DataFrame using a list

  20. 20

    List Comprehension Over Pandas Dataframe Rows

  21. 21

    Insert rows in Pandas dataframe after comparing with list

  22. 22

    Inserting named rows in dataframe based on a list pandas

  23. 23

    Split Pandas DataFrame with DatetimeIndex by na or missing rows into blocks

  24. 24

    Split pandas dataframe in two if it has more than 10 rows

  25. 25

    Split a Pandas Dataframe into multiple smaller dataframes based on empty rows

  26. 26

    How to loop through Pandas DataFrame and split a string into multiple rows

  27. 27

    Split pandas dataframe into multiple dataframes with equal numbers of rows

  28. 28

    Pandas: Split a dataframe rows and re-arrange column values

  29. 29

    split each cell in dataframe (pandas/python)

HotTag

Archive