How to preprocess tensorflow imdb_review dataset
For TypeErrors it is always good to check the exact type of the variable causing issues, especially when troubleshooting TensorFlow and Keras:
print(type(df['text']))

fit_on_texts expects a list of string or similar, but you are providing a dictionary, so you'll want to convert accordingly. Example:
from typing import List, Dict

foo_dict: Dict[str, str] = {&quot;one&quot;: &quot;first sentence&quot;, &quot;two&quot;: &quot;second sentence&quot;}
foo_list: List[str] = list(foo_dict.values())

print(foo_dict)
print(type(foo_dict))

print(foo_list)
print(type(foo_list))

Output:
{'one': 'first sentence', 'two': 'second sentence'}
&lt;class 'dict'&gt;
['first sentence', 'second sentence']
&lt;class 'list'&gt;

API docs will help here:
https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/text/Tokenizer#fit_on_texts
I'm using type annotations in the example above which I find helps troubleshooting and avoiding bugs.