-1

I have try many way, but there are error or N/A for those solution, can any people help me split the data? (Error: ValueError: Columns must be same length as key). The Data Type Is object

prices
1 [Apr 26 2013 01: +0, 13.326, 22]
2 [Apr 27 2013 01: +0, 14.301, 49]

INTO Something like this

date price volumn
1 26/04/2013 13.326 22
2 27/04/2013 14.301 49
4
  • 1
    Is your Prices column a string or a list of strings? Commented Dec 30, 2020 at 16:45
  • Does this answer your question? Pandas Split column into multiple columns by multiple string delimiters Commented Dec 30, 2020 at 16:45
  • It data type is object Commented Dec 30, 2020 at 16:46
  • there is a ValueError: Columns must be same length as key error Commented Dec 30, 2020 at 16:53

1 Answer 1

0

Assuming you have data in ['date','price','volume'] format, you can extract columns as follows.

import pandas as pd

data = {
    'date_price_volume' : [['Apr 26 2013 01: +0', 13.326, 22],['Apr 27 2013 01: +0', 14.301, 49]]
}

df = pd.DataFrame(data)
df = pd.DataFrame(df['date_price_volume'].to_list(), columns=['date','price','volume'])
df
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.