Typeerror: ‘column’ object is not callable

Hi, are you having a hard time trying to figure out the solutions for “typeerror: ‘column’ object is not callable”?

Fortunately, in this article, we delve into what this error is about, why it occurs, and how to troubleshoot it.

But before we dive into the solutions, let’s first educate ourselves with regards to this “column object is not callable typeerror.”

In that way, if you encounter this error again, you’ll already know how to fix it.

Let’s go!!!

What is “typeerror: ‘column’ object is not callable”?

The “typeerror: column’ object is not callable” is an error that occurs in Python when you are trying to call a PySpark’s dataframe column as a function or a method.

However, the column is not callable. It indicates that you’re trying to use a Column object as if it were a function

This is usually happens when you accidentally use parentheses to call a column instead of using brackets to access the column’s values.

This causes Python to interpret the column as a callable function or method, which it is not.

Moreover, this error usually raised while you’re working with PySpark and pandas library in Python

Why does this “typeerror column object is not callable” occur?

This column’ object is not callable occurs due to several reasons that include the following:

→ when you try to use a method or function that does not exist for the column object.
→ when you try to use a column object as if it were a function.

→ when you are calling a method directly on the column object.

→ when using an incorrect syntax.

→ when using an incorrect function name.

How to fix the “typeerror: ‘column’ object is not callable”

The following are the solutions you may use to resolve this typeerror column object is not callable error message.

Solution 1: Use the select() method

To solve this error, you can use the select() method from the DataFrame object to get a new DataFrame that contains only the column you want to show.
Then, use the show() method from the new DataFrame.

from pyspark.sql import SparkSession, Row

# create a SparkSession
spark = SparkSession.builder.getOrCreate()

# create a Spark DataFrame using PySpark's Row class
sdf = spark.createDataFrame(
    [Row(name="Caren", age=25),
     Row(name="Carla", age=26),

# select the 'name' and 'age' columns and display them using the show() method
sdf.select('name', 'age').show()

The sdf.select(‘name’, ‘age’) line selects the ‘name’ and ‘age’ columns from the DataFrame, and the show() method is used to display the results.

Output:

+-------+---+
|   name|age|
+-------+---+
|  Caren| 25|
|  Carla | 26|
+-------+---+

Solution 2: Use a user-defined function (UDF)

from pyspark.sql.functions import udf
from pyspark.sql.types import StringType, IntegerType
from pyspark.sql import SparkSession, Row

# define a function that converts text to uppercase

def to_upper(text):
    return text.upper()

# create a PySpark UDF using the to_upper function
to_upper_udf = udf(to_upper, StringType())

# create a SparkSession
spark = SparkSession.builder.getOrCreate()

# create a Spark DataFrame using PySpark's Row class
sdf = spark.createDataFrame(
    [Row(name="Caren", age=25),
     Row(name="Carla", age=26),

# apply the to_upper_udf function to the 'name' and 'age' columns of the DataFrame
new_df = sdf.withColumn("name", to_upper_udf('name')) \
            .withColumn("age", to_upper_udf('age').cast(IntegerType()))

# display the contents of the new DataFrame
new_df.show()

The sdf.withColumn(“name”, to_upper_udf(‘name’)).withColumn(“age”, to_upper_udf(‘age’).cast(IntegerType())) line applies the to_upper_udf function to both the ‘name’ and ‘age’ columns of the DataFrame sdf.

It creates a new DataFrame new_df with both columns in uppercase letters.

Take note that we also use the cast() method to cast the ‘age’ column to an IntegerType after applying the UDF to it.

Output:

+-------+---+
|   name|age|
+-------+---+
|  CAREN|  25|
|  CARLA |  26|
+-------+---+

Additional solutions for ‘column’ object is not callable:

  1. Ensure that you are using the correct syntax for calling functions and methods on Column objects.
  2. Ensure that you are using the correct function name and that it exists for the Column object.

Conclusion

By executing all the effective solutions for the “typeerror: ‘column’ object is not callable” that this article has already provided above, it will help you resolve the error.

We are hoping that this article provides you with sufficient solutions.

You could also check out other “typeerror” articles that may help you in the future if you encounter them.

Thank you very much for reading to the end of this article.

Understanding “object is not callable”

Calling (obj()) requires __call__ on the object. Lists, dicts, integers, and strings are not callable. TypeError fires the moment you add parentheses to a non-function.

Common triggers

  • Variable named the same as a builtin. list = [1,2,3] then list("abc") fails.
  • Missing operator. my_dict(key) instead of my_dict[key].
  • Class instance vs class. my_instance() fails unless the class implements __call__.
  • Import shadow. from math import sqrt, then later sqrt = compute_value(), then sqrt(16) fails.
  • Property misuse. Adding () after a @property attribute returns the value’s TypeError.

Diagnostic pattern

# BAD — shadowed builtin
list = [1, 2, 3]        # oops, now list is a list, not the type
print(list(range(5)))   # TypeError: 'list' object is not callable

# GOOD — never shadow built-ins
numbers = [1, 2, 3]
print(list(range(5)))   # works — list is still the type

Best practices

  • Never name variables after builtins: list, dict, set, str, int, id, type, sum, min, max, sorted, filter, map.
  • Configure a linter (Ruff, Pyflakes) to warn on builtin shadowing.
  • Use snake_case class instances so you never confuse instance vs class syntax.

Frequently Asked Questions

What is Python TypeError and what causes it?

TypeError is raised when an operation is applied to an object of the wrong type. Common patterns: calling a non-callable object, adding incompatible types (str + int), passing the wrong number of arguments, or accessing attributes on a NoneType. Each TypeError message names the operation and expected vs actual types, the fix is almost always to convert types explicitly (int(), str()) or fix the wrong variable assignment.

How do I quickly debug a Python TypeError?

Three steps: (1) Read the full error message, it names the exact operation and types involved. (2) Print the type of every variable in that line: print(type(var1), type(var2)). (3) Check what the function expected vs what you passed. Most TypeError fixes are 1-line type casts or fixing a variable that became None unexpectedly.

Should I catch TypeError or let it propagate?

For internal code, let TypeError propagate, it’s almost always a real bug (wrong type passed). For boundary code (parsing user input, third-party API responses), catch TypeError + ValueError together: try: parsed = int(value) except (TypeError, ValueError): parsed = 0. Catching internal TypeErrors hides bugs.

How do I prevent TypeError in production?

Three patterns: (1) Use type hints (def add(a: int, b: int) -> int) and check with mypy / pyright in CI. (2) Validate inputs at boundaries (Pydantic for FastAPI, DRF serializers for Django). (3) Default values that match expected types (return 0 not None for numeric functions). Static typing catches 80% of TypeErrors before runtime.

Where can I find more TypeError fixes?

Browse the TypeError reference hub for 220+ specific TypeError fixes. For broader Python debugging, see the Python Tutorial hub. For related error types, see ValueError and AttributeError guides.

Caren Bautista


Technical Writer at PIES IT Solution

Responsible for crafting clear, well-structured, and beginner-friendly content across the platform. Handles the writing, proofreading, and editorial review of tutorials, guides, and documentation to ensure every article is accurate, readable, and easy to follow.

Expertise: Technical Writing · Content Creation · Documentation · Editorial Writing · JavaScript · TypeScript · Python · Python Errors · HTTP Errors · MS Excel
 · View all posts by Caren Bautista →