Transpose, then unpack:

>>> x, y, z = data.T
>>> x
array([1, 4, 7])
Answer from behzad.nouri on Stack Overflow
Discussions

python - Splitting each item in an array into a separate data frame column - Stack Overflow
I'm relatively new to python. I have a data frame and I need to split each character of the data in each column into it's own column in another data frame. I split the data into a dictionary, but... More on stackoverflow.com
🌐 stackoverflow.com
May 4, 2015
python - split array rows into columns from commas - Stack Overflow
I had a list consisted of 53 3D points, I converted the list into numpy array and I have a (53,) shape array. Each row is consisted of three float points separated by commas (e.g. a_t[0]=73.72,32.2... More on stackoverflow.com
🌐 stackoverflow.com
July 19, 2013
How to split array with 1 column into multiple columns (numpy array) - Stack Overflow
I currently have a .txt file that has been loaded into python as a list, and then placed into a np array as a single column with n number of rows depending on the file size. The file has rows trimm... More on stackoverflow.com
🌐 stackoverflow.com
Separate large arrays into separate columns of pandas dataframe
new_df = pd.concat([pd.DataFrame(df['Column 1'].tolist()), pd.DataFrame(df['Column 2'].tolist())], axis=1) More on reddit.com
🌐 r/learnpython
5
1
July 1, 2021
🌐
w3resource
w3resource.com › numpy › manipulation › hsplit.php
NumPy: numpy.hsplit() function - w3resource
April 24, 2026 - The numpy.hsplit() function is used to split an array into multiple sub-arrays horizontally (column-wise).
🌐
W3Schools
w3schools.com › python › numpy › numpy_array_split.asp
NumPy Splitting Array
Use the hsplit() method to split the 2-D array into three 2-D arrays along columns.
🌐
Stack Overflow
stackoverflow.com › questions › 58964668 › how-to-split-array-with-1-column-into-multiple-columns-numpy-array
How to split array with 1 column into multiple columns (numpy array) - Stack Overflow
Turn that back into numpy (2D). Then use transpose to access columns rather than rows. Also I'd use pandas, which can recognize a list of rows as a dataframe in a single line. ... Go back to the result line. Is line.split(',') right? Are columns of really divided by commas. Your array display suggests not.
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › separate large arrays into separate columns of pandas dataframe
r/learnpython on Reddit: Separate large arrays into separate columns of pandas dataframe
July 1, 2021 -

So I have a pandas dataframe which contains around 10 columns. Each of the 1000+ (we'll just label it 'z') elements of two of these columns is a list of n values, and when matched they form sets of (x, y) pairs. So those two columns look something like this:

Column 1 Column 2
1 (x0, x1, ..., xn) (y0, y1, ..., yn)
... ... ...
z (x0, x1, ..., xn) (y0, y1, ..., yn)

I want to separate these columns into individual elements. In other words rather than just the two columns, I want a new dataframe to have 2n columns, one for each x and one for each y. I thought of using numpy's array_split(), but I'm not sure how to implement that in a large enough scale without hardcoding it, which isn't really an option. Is anyone aware of a way to go about this?

🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-hsplit-function-python
numpy.hsplit() function | Python - GeeksforGeeks
July 12, 2025 - The numpy.hsplit() function is used to split a NumPy array into multiple sub-arrays horizontally (column-wise). It is equivalent to using the numpy.split() function with axis=1. Regardless of the dimensionality of the input array, numpy.hsplit() ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › spark-split-array-to-separate-column
Spark - Split array to separate column - GeeksforGeeks
July 23, 2025 - The split method returns a new PySpark Column object that represents an array of strings.
Top answer
1 of 13
560

You can use the DataFrame constructor with lists created by to_list:

import pandas as pd

d1 = {'teams': [['SF', 'NYG'],['SF', 'NYG'],['SF', 'NYG'],
                ['SF', 'NYG'],['SF', 'NYG'],['SF', 'NYG'],['SF', 'NYG']]}
df2 = pd.DataFrame(d1)
print (df2)
       teams
0  [SF, NYG]
1  [SF, NYG]
2  [SF, NYG]
3  [SF, NYG]
4  [SF, NYG]
5  [SF, NYG]
6  [SF, NYG]

df2[['team1','team2']] = pd.DataFrame(df2.teams.tolist(), index= df2.index)
print (df2)
       teams team1 team2
0  [SF, NYG]    SF   NYG
1  [SF, NYG]    SF   NYG
2  [SF, NYG]    SF   NYG
3  [SF, NYG]    SF   NYG
4  [SF, NYG]    SF   NYG
5  [SF, NYG]    SF   NYG
6  [SF, NYG]    SF   NYG

And for a new DataFrame:

df3 = pd.DataFrame(df2['teams'].to_list(), columns=['team1','team2'])
print (df3)
  team1 team2
0    SF   NYG
1    SF   NYG
2    SF   NYG
3    SF   NYG
4    SF   NYG
5    SF   NYG
6    SF   NYG

A solution with apply(pd.Series) is very slow:

#7k rows
df2 = pd.concat([df2]*1000).reset_index(drop=True)

In [121]: %timeit df2['teams'].apply(pd.Series)
1.79 s ± 52.5 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

In [122]: %timeit pd.DataFrame(df2['teams'].to_list(), columns=['team1','team2'])
1.63 ms ± 54.3 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
2 of 13
126

Much simpler solution:

pd.DataFrame(df2["teams"].to_list(), columns=['team1', 'team2'])

Yields,

  team1 team2
-------------
0    SF   NYG
1    SF   NYG
2    SF   NYG
3    SF   NYG
4    SF   NYG
5    SF   NYG
6    SF   NYG
7    SF   NYG

If you wanted to split a column of delimited strings rather than lists, you could similarly do:

pd.DataFrame(df["teams"].str.split('<delim>', expand=True).values,
             columns=['team1', 'team2'])
Top answer
1 of 1
1

The reason is the lists are still stored as strings in the hashtags column when you read them with read_csv. You can convert them upon reading of the data (follwing code taken from the Colab notebook):

import pandas as pd
from ast import literal_eval

url = "https://raw.githubusercontent.com/hashimputhiyakath/datasets/main/hashtags10.csv"

# Notice the added converter to turn strings into lists.
df = pd.read_csv(url, converters={'hashtags': literal_eval})

And then the solution you mentioned will work as expected.

df_hashtags_splitted = pd.DataFrame(df['hashtags'].tolist(), index=df.index).add_prefix('hashtag_')
print(df_hashtags_splitted.head(10))
          hashtag_0     hashtag_1         hashtag_2       hashtag_3           hashtag_4       hashtag_5    hashtag_6         hashtag_7  hashtag_8       hashtag_9 hashtag_10 hashtag_11
0         longcovid     covidhelp              None            None                None            None         None              None       None            None       None       None
1            mumbai         covid      hospitalbeds  covidemergency           mahacovid       oxygenbed  mumbaicovid  covid19indiahelp  covidhelp  covidresources       None       None
2   kawahcoffeeshop   coffeelover             kawah       costarica            puravida         heredia       oxygen              None       None            None       None       None
3           lucknow        mumbai         hyderabad           delhi            verified  covidresources    covidhelp  covid19indiahelp       None            None       None       None
4            oxygen          None              None            None                None            None         None              None       None            None       None       None
5  covid19indiahelp        mahara              None            None                None            None         None              None       None            None       None       None
6            oxygen       amadoda              None            None                None            None         None              None       None            None       None       None
7  plasmadonordelhi  plasmamumbai  covid19indiahelp       covidhelp  covidemergency2021            None         None              None       None            None       None       None
8            oxygen  conservation           wilding       rewilding         environment  sustainability  restorative       agriculture   wildlife    biodiversity      water   wildswim
9             covid      verified            mumbai          oxygen  covidemergency2021         covid19    covidhelp    covidresources       None            None       None       None

Alternatively, to convert the lists to strings after you read the csv you can do:

df['hashtags'] = df['hashtags'].map(literal_eval)
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.Series.str.split.html
pandas.Series.str.split — pandas 3.0.6 documentation - PyData |
>>> s.str.split(pat="/") 0 [this is a regular sentence] 1 [https:, , docs.python.org, 3, tutorial, index... 2 NaN dtype: object · When using expand=True, the split elements will expand out into separate columns.
🌐
YouTube
youtube.com › watch
How to Split a DataFrame Array into Columns Using Python in Databricks - YouTube
Learn how to efficiently split a DataFrame array into separate columns using Python code in Databricks, ideal for beginners and data professionals alike.---T...
Published: March 30, 2025
Views: 11