How to Convert Pandas Column to List in Python

As a seasoned Python developer, I have spent countless hours wrangling data for various US-based fintech and retail firms. One of the most frequent tasks I encounter is the need to pull a specific column out of a Pandas DataFrame and turn it into a standard Python list.

Whether I am preparing data for a custom machine learning model or just need to iterate through specific US zip codes to trigger a mailing service, knowing how to convert a column to a list efficiently is a must-have skill.

In this tutorial, I will show you several ways to change a Pandas column into a list based on my firsthand experience with real-world datasets.

The Easiest Way: Use to_list()

When I first started with Pandas, I used to look for complex ways to extract data. Then I discovered the to_list() method, which is by far the easiest approach.

It is a built-in Series method, so it feels very “native” to the library. I use this daily when I need to pass a single column of employee names or transaction IDs into a function that doesn’t support Pandas objects.

import pandas as pd

# Let's assume we are working with sales data for a US retail store
data = {
    'State': ['New York', 'California', 'Texas', 'Florida', 'Illinois'],
    'Sales_USD': [25000, 31000, 28000, 22000, 19000]
}

df = pd.DataFrame(data)

# I want to get the 'State' column as a Python list
states_list = df['State'].to_list()

print(states_list)
# Output: ['New York', 'California', 'Texas', 'Florida', 'Illinois']

You can see the output in the screenshot below.

Convert Pandas Column to List in Python

In the code above, I simply selected the column as a Series and called .to_list(). It is clean, readable, and does exactly what you expect.

Use the tolist() Alias

You might see some developers using .tolist() without the underscore. In my experience, both work the same way in Pandas.

The tolist() version is actually inherited from NumPy. Since Pandas is built on top of NumPy, it keeps this for compatibility.

# Using the alias without the underscore
sales_values = df['Sales_USD'].tolist()

print(sales_values)
# Output: [25000, 31000, 28000, 22000, 19000]

You can see the output in the screenshot below.

Convert Pandas Column to List

I personally prefer to_list() because it matches the naming convention of other Pandas methods like to_csv() or to_dict().

Use the list() Constructor

Sometimes I want to keep things strictly “Pythonic.” In those cases, I use the built-in list() constructor.

This is a great option when you want to make it clear to anyone reading your code that you are forcing a type conversion. It works perfectly with any Pandas Series.

# Converting using the standard Python list function
states_pythonic = list(df['State'])

print(states_pythonic)

You can see the output in the screenshot below.

How to Convert Pandas Column to List in Python

One thing I have noticed over the years is that list(df[‘column’]) is occasionally slightly slower than .to_list() on massive datasets, but for most daily tasks, you won’t feel the difference.

Use values.tolist() for Performance

When I am working with millions of rows of high-frequency trading data or large-scale US census files, performance becomes a priority.

In these situations, I often access the underlying NumPy array first using .values and then convert it to a list.

# Accessing the underlying array for a speed boost
fast_list = df['Sales_USD'].values.tolist()

print(fast_list)

You can see the output in the screenshot below.

Convert Column to List in Python Pandas

By calling .values, we are bypassing some of the Pandas overhead and talking directly to the NumPy layer. If your script is feeling sluggish, try this method.

Convert a Column by Index

I often deal with messy datasets where the column names have trailing spaces or weird characters. Instead of fighting with the names, I just use the column position.

The .iloc indexer is my best friend here. It allows me to grab the first or second column without needing to know its exact string name.

# Grabbing the first column (index 0) regardless of its name
first_col_list = df.iloc[:, 0].to_list()

print(first_col_list)

This is incredibly useful when building automated pipelines that process CSV files from different US vendors where the headers might change slightly but the order stays the same.

Extract Unique Values to a List

A common request I get is to provide a list of unique values from a column, for example, a list of all unique US states present in a shipping log.

You can chain the .unique() method with .tolist() to get this done in a single line of code.

# Sample data with duplicates
shipping_data = {'Destination': ['NY', 'CA', 'TX', 'NY', 'TX', 'FL']}
df_ship = pd.DataFrame(shipping_data)

# Get only the unique destinations
unique_destinations = df_ship['Destination'].unique().tolist()

print(unique_destinations)
# Output: ['NY', 'CA', 'TX', 'FL']

This saves me from having to convert the whole column and then run a set() operation on it manually.

Handle Multi-Index Columns

If you are working with complex financial reports that use a Multi-Index (hierarchical columns), selecting a column can be tricky.

I usually flatten the selection or use a tuple to target the specific level I need before converting.

# Creating a Multi-Index DataFrame
columns = pd.MultiIndex.from_tuples([('Finance', 'Revenue'), ('Finance', 'Profit')])
df_multi = pd.DataFrame([[500, 100], [600, 150]], columns=columns)

# Converting a specific sub-column to a list
revenue_list = df_multi[('Finance', 'Revenue')].to_list()

print(revenue_list)

Even with complex structures, the end goal is always to get back to a Series object so we can use our trusty conversion methods.

Conclusion

Converting a Pandas column to a list is one of those fundamental tasks that you will perform thousands of times in your career. I personally stick with .to_list() for its readability, but knowing when to use .values.tolist() for speed has saved me a lot of time on bigger projects.

I hope this guide helps you handle your data more effectively. If you are working on a project involving US-based data, these methods will ensure your data flows smoothly between Pandas and your other Python functions.

You may also like to read:

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.