> ## Content Index
> Fetch the complete content index at: https://datascientyst.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Pandas TypeError 'list' object is not callable - rename Pandas columns
- URL: https://datascientyst.com/pandas-typeerror-list-object-is-not-callable-rename-pandas-columns/
- Published: 2025-04-12T12:56:40.000Z
- Updated: 2025-04-12T12:56:40.000Z
- Author: John D K
- Tags: Column, Pandas Error

The Pandas error `'list' object is not callable` is raised when we try to rename dataframe columns. Usually this means that we try to use list instead of a dict with method: `.rename()`.

```python
df.rename(columns=['A', 'B', 'C'])

```

results into:

> TypeError: 'list' object is not callable

while

```python
cols = {'A':'AA', 'B': 'BB', 'C': 'CC'}
df.rename(columns=cols)

```

works fine.

Here's how to **correctly rename columns in pandas** and avoid the error:

## 1\. Rename with a dictionary using `.rename()`

The correct syntax for renaming Pandas columns is:

```python
df = df.rename(columns={'old_name': 'new_name'})

```

Below you can find full example of renaming columns:

```python
import pandas as pd

df = pd.DataFrame({
  "A": [0, 1, 2, 3],
  "B": [3, 5, 7, 9],
  "C": [1, 2, 3, 4]
})

cols = {'A':'AA', 'B': 'BB', 'C': 'CC'}
df.rename(columns=cols)

```

## 2\. Replace all headers at once using `df.columns = [...]`

```python
df.columns = ['AA', 'BB', 'CC']

```

---

## 3\. Mistake `TypeError: 'Index' object is not callable`

Similar miskate `TypeError: 'Index' object is not callable` is raised when we try to invoke dataframe attribute as a method:

```python
df.columns('name', 'age', 'country')

```

This is because `df.columns` is attribe, and we're using `()` as if it were a function.

### Error:

```python
df.columns('A', 'B', 'C')

```

### Solution:

```python
df.columns = ['A', 'B', 'C']

```

This typically happens with incorrect use of parentheses `()` instead of square brackets `[]`.

In this short post we saw the reasons and solutions for 2 typical Pandas errors:

- `TypeError: 'list' object is not callable`
- `TypeError: 'Index' object is not callable`

## Resources

- [Comprehensive list of most common pandas errors](https://datascientyst.com/416-pandas-error/)
- [Pandas column guides and tutorials](https://datascientyst.com/column/)
- [Rename headers - 'list' object is not callable](https://stackoverflow.com/questions/60430241/rename-headers-list-object-is-not-callable?ref=datascientyst.com)