logging_level_ENUM = ('critical', 'error', 'warning', 'info', 'debug') Basically, when you create a dictionnary in python (which is most probably happening in your call to the ENUM function), the keys need to be. import random import statistics from time import sleep i=0 a=0 var1=input ("min random : ") var2=input ("max random : ") bb=int (var1) ba=int (var2) data = [ []for z. The benefits of a set are: very fast membership testing along with being able to use powerful set operations, like union, difference, and intersection. Even if it seem to work, it is a terrible solution. Since we assume this list contains only one element, we take the first, and use list. What causes the “TypeError: unhashable type: ‘list'” error? What is a list in Python? In Python, a list is a sequence of values. actions) You've probably attempted to use mutable objects such as lists, as the key for a dictionary, or as a member of a set. In python, a list cannot be used as key in a dict. Improve this question. 4. Iterate and Lemmatize List. An unhashable type is any data type or object in Python that cannot be hashed. py", line 41, in train_woe = sc. 自分で定義したオブジェクトを辞書のkeyに設定しようとすると、ハッシュ化できないからエラーになる。. P. If we convert it into a string as 'd' then this will work fine. Attempted to add a second y-axes using the code below:You simply messed up creating a new key - dicts are implemented as hash-maps and requires hashable objects as their keys. The unhashable type: ‘dict’ flask code exception usually affects the program when adding an unhashable dictionary key. 1. However, since a Python list is a mutable and ordered data type, we can both access any of its items and modify them: # Access the 1st item of the list. 4. Hash values are a numeric constructs that can’t change and thus allows to uniquely identify each object. Community Bot. From the Python glossary: An object is hashable if it has a hash value which never changes during its lifetime (it needs a __hash__ () method), and can be compared to other objects (it needs an __eq__ () or __cmp__ () method). when y. Why are slice objects not hashable in python. DataFrame (list (cursor_list)) contacts = contacts. This is a list: If so, I'll show you the steps - how to investigate the errors and possible solution depending on the reason. Follow edited Jul 23, 2015 at 15:27. Consider other unhashable types such as a list containing duplicate pandas dataframes. iloc () I'm currently doing some AI research for a project and for that I have to get used to a framework called "Pytorch". Python lists are not hashable because they are mutable. )) function and iterate through it so that you can retrieve the POS tag and tokens, i. value_counts () But if need only length of empty lists use str. 412. Groupby id a column that contains lists. Improve this answer. a dict is not hashable is because it is mutable. And, the model contains three entries for the. The docs say:. 1 Answer. For example, an object of type tuple can be hashable or not. print(tpl[0][0]). We can access an element from a list using subscript notation. This is because the implementation uses some hash table to lookup the arguments efficiently. After it, we can easily convert the outer list into a set python object. 2. Sorted by: 3. As a solution, you can transform these values to be a frozenset of the tuples, and then use drop_duplicates. 4. d = dict() d[ (0,0) ] = 1 #perfectly fine d[ (0,[0]) ] = 1 #throws Hashability and immutability refer to object instancess, not type. also a good explanation from a kind mate: " but I think the reason for lists not working is the following. TypeError: unhashable type: 'list' We see that Python tuples can be either hashable or unhashable. e. 1. 4. See the *args in the transpose docs. When we try to hash the tuple using the built-in hash () function, we get a unique hash value. If you want to use lru_cache the arguments must be, for example, tuple s instead of list s. datablock = DataBlock (blocks = [text_block, MultiCategoryBlock], get_x=ColReader (twipper. Learn more about TeamsAssuming each element in new_list_of_dict has one key-value pair:. For example: corpus = [ ["lorem", "ipsum"], ["dolor"], ["sit", "amet"]] is a valid parameter for the Word2Vec function. 사전은 키-값 쌍으로 작동하는 Python의 데이터 구조이며 모든 키에는 그에 대한 값이 있으며 값의 값에. 2 Answers. b) words = [w for doc in docs for w in doc] to merge your word lists to a single one. Lists are unhashable because they are mutable; changing their contents would change their hashvalue, which is not allowed. @dataclass (frozen=True, eq=True) class Table: name: str signature: Dict [str, Type [DBType]] prinmary_key: str foreign_keys: Dict [str, Type [ForeignKey]] indexed: List [str] Don't understand what's the problem. 따라서 이를 해결하기 위해서는 a[1] 과 같이 접근해야하고, 그럼 int type으로 변환이 필요하다. The best I can point you to is the archive link for that entire month of messages ; you can Ctrl-F for { to find the relevant ones (and a few false positives). The original group pipes is shadowed by the list of pipes and creating a new Pipe object fails: pipes = [Pipe ()] Use different names for the group and the list. When I try to call the function on a list, I get this error: 'TypeError: unhashable type: 'list''. A simple workaround would be to convert the lists to tuples which are hashable. close() infile2. . A possible cause of unhashable “TypeError” is when you’re using a list as a dictionary key. 6 or above Sqlalchemy does not support auto increment for oracle 11g. Thanks for your answer. Simple approach: DY = {key: value for keys, value in zip (YiW, YiV) for key in keys} Note that this will drop data if any key appears more than once (so if YiW contains both ["africa", "trip"] and. str. Don't understand what the problem is. eq(list). Symmetric difference of two pandas dataframes. AMC. ] What do we do then? Once you know the trick, it’s quite simple. Sometimes mutable types like lists (or Series in this case) can sneak into your collection of immutable objects. 2 Answers. e. 4. 2k 2 2 gold badges 48 48 silver badges 73 73 bronze badges. But i am getting TypeError: not all arguments converted during string formatting. But it throws a TypeError:def my_serialize(key_nums: list): key_nums = sorted(key_nums) base = max(key_nums) sum_ = 0 for power, num in enumerate(key_nums): sum_ += base**power * num return sum_ which should give you a unique (incredibly large!) integer to store that will be smaller in memory than the tuple. Sorted by: 3. Q&A for work. python; pandas; Share. (Column C should be excluded for explosion for one of its elements has different size)For a current research project, I am planning to read the JSON object "Main_Text" within a pre-defined time range on basis of Python/Pandas. drop_duplicates hashes the objects to keep track of which ones have been seen or not, efficiently. Ask Question Asked 4 years, 2 months ago. replace('. Furthermore, unintended Series objects may be the cause. The issue is that you have a surrounding set of braces - {. most_common ()) That's normal. In the second example (with `lru_cache`), calculating the 40th Fibonacci number took approximately 8. These objects must be immutable, meaning they can’t be changed,. Since it is unhashable, a Series object is not a good fit for any of these. Dictionaries, in Python, are also known as "mappings", because they "map" or "associate" key objects to value objects: Toggle line numbers. You would probably need to do this in two steps: first load, then apply+drop: contacts = pd. ndarray' Hot Network Questions Why space is [not] ignored in macro arguments? Is it possible to edit name in a paper at the stage of pre-proof correction after acceptance? Not sure if "combined 90 men’s years experience" is right usage as opposed to "combined 90 man years worth of. transpose ('lat','lon','sector','time') Share. Generic type-checking. descending. 03:07 So now that you know what immutable and hashable mean, let’s look at how we can define sets. You have 3 options: Set frozen=True (in combination with the default eq=True ), which will make your class immutable and hashable. Because python lists are mutable (ie they can change content), they can't have a fixed hash value associated with them. @dataclass (frozen=True) Set unsafe_hash=True, which will create a __hash__ method but leave your class mutable. This works, if that's what you want! There's a catch, though! We can only use tuples (or frozensets) if items in the dictionary are all hashable. Also, nested lists might needed to be flattened. For example, using a list as a key in a Python dictionary will cause this error since dictionaries only accept hashable data types as a key. The TypeError: unhashable type: 'list' usually occurs when you try to use a list object as a set element or dictionary key and Python internally passes the unhashable list into the hash() function. 1 Answer. ・リストを集合型のキーとして使用している?. lookup_field - The model field that should be used to for performing object lookup of individual model instances. When you store the hash of a value in, for example, a dict, if the object changes, the stored hash value won't find out, so it will remain the same. Stack Overflow. 7 dictionaries are ordered data collections; in Python 3. Reload to refresh your session. I know this is old, but it still comes up first in Google. Now when I am self joining it,it is giving error, TypeError: unhashable type: 'list' . As workaround, consider assign of flags to then query against. Annotated type hints in guaranteed constant time. The unhashable part refers to the key only. using this code: def create_from_arr (): baby_array=pd. You can fix this by converting each list to a tuple, and using the tuples as the keys of the sets. not changeable). Closed adamerose opened this issue Feb 11, 2021 · 6 comments · Fixed by #40414. fromkeys will accept any iterable as an argument (this is duck-typing ). If you're using a class because you want to save some state on the instance, this sounds like a bit of an antipattern but you'd be able to get away with it like so: If you just want the class for the semantics/namespace (you should. Modified 1 year, 1 month ago. ['d'] can’t be hashed and hence Python faces trouble. Thanks, I have solved my code problem. 使用元组替代列表. 6 development notwithstanding) is not ordered and so what you will get back from dict. Follow edited Jul 10, 2020 at 19:34. 0. The Python TypeError: unhashable type: 'dict' can be fixed by casting a dictionary to a hashable object such as tuple before using it as a key in another dictionary: my_dict = {1: 'A', tuple({2: 'B', 3: 'C'}): 'D'}. To do this use dict. , "Flexible function and variable annotations")-compliant typing. I want to update a piechart with dash: @app. In this article, you will learn about how to fix TypeError: unhashable type: ‘list’ in python. So in your for j in a:, you are getting item from outer list. Consider a tuple which has a list (mutable). This will transform the lists into tuples, which are hashable (and immutable). pandas: TypeError: unhashable type: 'list' 1. i confused what's make those list different. drop_duplicates () And make sure to use it on specific columns which need it, and not all. Follow edited Nov 26, 2021 at 20:21. 8k 21 21 gold badges 114 114 silver badges 146 146 bronze badges. Unhashable Type ‘List’ in Python. items (): keys. Then in. Lists are unhashable because they are mutable; changing their contents would change their hashvalue, which is not allowed. A dict (recent python 3. If you try to slice a…Misunderstanding in the author list. For your case you can simply do: tmp1 = tmp [list (tmp) [0]] However this can be quite expensive. unique() function compares values in the column to each other using their hash values. >>> print (dict. Share. Solution 2 – By Adding list as a value in a dictionary. default_option = preprocessor_filters[control_type] TypeError: unhashable type: 'list' The text was updated successfully, but these errors were encountered: All reactions. 1 Answer. Solution 1 – By Converting list into a tuple. How to fix the Python TypeError: Unhashable Type: ‘List’ errorDescribe the bug After restarting the webui today, the program that was running normally did not start, and it seems to no file changes were made to the file during that time. Learn more about TeamsTypeError: unhashable type: 'list' when using collections. You have a Ratings column which is filled with dictionaries. TypeError: unhashable type: 'list' for comparing pandas columns. A set contains unique elements. Pandas: Unhashable type list Hot Network Questions Is the expectation of a random vector multiplied by its transpose equal to the product of the expectation of the vector and that of the transpose Fix TypeError: unhashable type: ‘list’ in Python . Sorted by: 274. duplicated ()] 0 0 [1, 0] 1 [0, 0]TypeError: unhashable type: 'list' Solution To fix this error, you can convert the 'list' into a hashable object like 'tuple' and then use it as a key for a dictionary as shown belowTypeError: unhashable type: ‘slice’ A slice is a subset of a sequence such as a string, a list, or a tuple. Why Python TypeError: unhashable type: 'list' Hot Network Questions Exploring the Concept of "No Mind" in Eastern Philosophy: An Inquiry into the Foundations and Implicationspython遇到TypeError: unhashable type: ‘list’ 今天在写这个泰坦尼克号的时候,出现了这个bug。后来检查后,才发现Embarked这一列被我改成list类型了,自然不能够hash。因此对原始数据,重新跑一遍后,结果正确。 Examples of hashable objects: int, float, decimal, complex, bool, string, tuple, range, frozenset, bytes Examples of Unhash1 # Unhashable type (list) 2 my_list = [1, 2, 3] ----> 3 print (hash (my_list)) TypeError: unhashable type: 'list'. Someone suggested to use isin (and then deleted the. Sorted by: 11. You signed in with another tab or window. Teams. When you try to typecast a nested list object directly into a set object using the set() function. frame. 1 Answer. In your case it looks like results is a dict containing list objects, which are not hashable. From a text file containing three columns of data I want to be able to just take a slice of data from all three columns where the values in the first column are equal to the values defined in above. read_csv (filename) data = data. string). then, i check the type of reference and candidate, both from the original code and the modified, it return the same type list. The error TypeError: unhashable type: 'list’ explain itself what it means. Improve this question. Series, my preferred approaches are. The way you tried to index into the Dataframe by passing a tuple of single-element lists will interpret each of those single element lists as indicesascending bool or list of bool, default True. Hot Network Questions Cramer-Rao bound for biased estimators Drawing chemistry rings with charges on them 70's or 80's movie in which an older gentleman uses a magic paintbrush to paint living children into paintings they can't escape Why not put a crystal oscillator inside the. The goal of my code below is to take 10 number from random. In the above example, we create a tuple my_tuple and a dictionary my_dict. In the place you'd put in the groupby criterion df. 1 Answer. That’s because the hash value of an object must remain constant during its lifetime. Follow edited Mar 3,. TypeError: unhashable type: 'dict' The reason why e. zip returns a list of tuples, not a tuple. robert robert. Steps to reproduce Run this code import streamlit as st import pandas as pd @st. dumps() :2. To allow unhashable keys in Counter, I made a Container class, which will try to get the object's default hash function, but if it fails, it will try its identity function. Since you are not modifying the lists, but only slicing, you may pass tuples, which are hashable. Python の TypeError: unhashable type: 'slice' を修正. 0. The TypeError: unhashable type: 'list' usually occurs when you try to use a list object as a set element or dictionary key and Python internally passes the unhashable list into the hash() function. GETTING A TypeError: unhashable type: 'list' 0. 5. It would load all countries with the name DummyCountry, but only name and id fields. If X is a list, tuple, Python set, or X. Hash values are a numeric constructs that can’t change and thus allows to uniquely identify each object. for key, value in dct. List is a mutable type which cannot be hashed. 위와 같이 코딩하게 된다면, 위에서 나온 에러 (TypeError: unhashable type: 'list')를 만날 수 있다. You provide an unhashable key (args,kwargs) since kwargs is a dict which is unhashable. Hot Network Questions Print the answer before a given answer How to describe the Sun's location to an alien from our Galaxy?. search (r' ( [a-zA-Z_]+)food', homeFoodpath). wovano. temp = nr. Follow edited Dec 21, 2015 at 0:09. falsetru. What you need is to get just the first item in list, written like so k = list[0]. and I thinks you want to use {'List_of_date': List_of_date} as context for template render. However elem need to be something hashable. This question needs debugging details. The clever idea to use foo. NLTK TypeError: unhashable type: 'list'. ndarray 错误Creates a new dataclass with name cls_name, fields as defined in fields, base classes as given in bases, and initialized with a namespace as given in namespace. Follow edited Nov 10, 2021 at 4:04. if you are using "oracle 11g" then use following code: from sqlalchemy import event from sqlalchemy. Looks like you node is really a list and it rightly refuse to add a list to a set (as it is unhashable). TypeError: unhashable type: 'list' in python nltk. Yep - pandas. iloc[:,:1] For your second problem, the X input needs to be a matrix, not a vector, so either include more columns or use the syntax:Unfortunately, it looks like mailing list archive links are unstable. Connect and share knowledge within a single location that is structured and easy to search. for x in randomnodes: if len (randomnodes)<=100: randomnodes. 6. Next actually keeping the list of tokenized words and then the list of pos tags and then the list of lemmas separately sounds logical but since the function finally only returns the function, you should be able to chain up the pos_tag(word_tokenize(. Not to mention that in some cases the underlying estimators would have to be wrapped to undo the conversion (or some other mehtod such as. for p in punctuations: data = data. If you must, you can convert the list into a tuple to use it in a dictionary as a key. Teams. TypeError: "unhashable type: 'list'" python; Share. Follow edited Nov 7, 2016 at 17:54. Mar 12, 2015 at 1:44. TypeError: unhashable type: 'list' 上記のようなエラーが出た時の対処法。 自分で定義したオブジェクトを辞書のkeyに設定しようとすると、ハッシュ化できないからエラーになる。 intやstrのようなハッシュ化可能なオブジェクトをkeyに設定する必要がある。The error: TypeError: unhashable type: ‘list’ occurs when trying to get the hash value of a list. list s are mutable and therefore cannot be hashed. items()[0] for d in new_list_of_dict]) Explanation: items() returns a list of the dictionary's key-value pairs, where each element in the list is a tuple (key, value). txt", 'r') data1 = infile1. 1 Answer. Solution to TypeError: unhashable type: ‘list’. add_loss(loss) --> TypeError: unhashable type: 'ListWrapper' Problem ? 👀 5 NickDatLe, federicoAntosiano, meera-m-t, shanglike, and SongShuCheng reacted with eyes emojiBUG: to_datetime throws TypeError: unhashable type: 'list' even with errors='ignore' #39756. When you reference a key, you’ll be able to retrieve the value associated with that key. woebin_ply(train, bins) File "C:UsersLaurence. To use a dict as a key you need to turn it into something that may be hashed first. This will return the subset of rows where at least a single cell is a list, which should help you locate the problem. Highest score (default) USE sqlalchemy 1. If an object’s content can change (making it mutable, like lists or dictionaries), it’s typically unhashable. Xarray’s transpose accepts the target dimensions as multiple arguments, not a list of dimensions. If anyone wants to shed some light on the other bugs are also. Deep typing. In Standard. Improve this question. What does "TypeError: unhashable type: 'slice'" mean? And how can I fix it? 0. This also tells me that in your rogue list is. You are returning a list to something that expects a hashable type, like an int, a string or a tuple of hashable types. Hashability makes an object usable as a dictionary key and a set member, because these data structures use the hash value internally. The variable v in this expression: key, v = spl [0], spl [1:] is a list with the remaining values. The update method is used to fill in NaN values from a with corresponding values from a_y, and then the same is also done for b. For sure it cannot be set, but look here: for keys in favorite_languages: if people in favorite_languages: # your elem = poeple (which is set) print (f"Thanks for taking our poll {people}")Because lists are unhashable and you are trying to store a structure which contains a list in a hash-based data structure. As a result the hash can change violating the contract. I submit the following code to the website to solve a problem that involves counting the number of ways to traverse a matrix that includes a number of obstacles: from functools import cache class Solution: def uniquePathsWithObstacles (self, obstacleGrid: List [List [int]]) -> int: start = (0,0) return self. any(1)]. The idea is that I analyse a set of facial features from a prepared. S: The code has a whole lot of bugs so don't mind that. python遇到TypeError: unhashable type: ‘list’ 今天在写这个泰坦尼克号的时候,出现了这个bug。后来检查后,才发现Embarked这一列被我改成list类型了,自然不能够hash。 To get nunique or unique in a pandas. JDiMatteo JDiMatteo. com The Python TypeError: unhashable type: 'list' usually means that a list is being used as a hash argument. Here is a snippet that may be helpful. import pickle. Learn more about Teams1 Answer. 1. Since tuple is immutable object, it can be used as key in dictionary. df['Ratings'] = df. I am trying to execute a method on an odoo10 server using the xmlrpclib. If all you need is any element from the dictionary then you could do:You can't groupby by any column that contains an unhashable type, a list is one of those, for instance if you did df. 5 hash (t2) # TypeError: unhashable type: 'list' สำหรับ User-defined Types เช่นการสร้างคลาสและออบเจ็กต์ขึ้นมาเอง โดยปกติจะถือว่าเป็น hashable object นั่นเพราะค่าปกติของ hash. The variable v in this expression: key, v = spl [0], spl [1:] is a list with the remaining values. This will return the subset of rows where at least a single cell is a list, which should help you locate the problem. See also TypeError: unhashable type: 'list' when using built-in set function for more information on that. The. Problem with dictionary iteration in python. –A list is a mutable type, and cannot be used as a key in a dictionary (it could change in-place making the key no longer locatable in the internal hash table of the dictionary). The "TypeError: unhashable type: 'list'" error occurs when attempting to use a list as a hashable object. It. Is there a better way to do what I am trying to do? python; python-2. cartier April 3, 2018, 4:37am 1. From your sample dataframe, it appears your airline series consists of list objects. Here is when you can get the unhashable type ‘list’ error in Python… Let’s create a set of numbers: >>> numbers = {1, 2, 3, 4} >>> type(numbers) <class 'set'> All good so. I have listA=[[0,1,2]], and listB=[[0,1,2],[0,1,3],[0,2,3]], and want to obtain elements that are in listB but not in listA, i. xlsx', sheet_name='my_sheet') Or for first: df = pd. TypeError: unhashable type: 'set' sage: s = X. When we try to hash the tuple using the built-in hash () function, we get a unique hash value. Lê Hồng Nhật. 4. Immutable vs. Meng He Meng He. ?. Community Bot. logging_level_ENUM = ('critical', 'error', 'warning', 'info', 'debug') Basically, when you create a dictionnary in python (which is most probably happening in your call to the ENUM function), the keys need to be. Tuples are hashable. xlsx') If need processing all sheetnames converted to DataFrame s:The type class returns the type of an object. Series, my preferred approaches are. TypeError: unhashable type: ‘Scatter’ when trying to create scatter plot with multiple axes. Please help. Modified 4 years, 2 months ago. transform (tuple) – Panwen Wang. TypeError: unhashable type: 'list'. Pandas, unique conditional with column string appending. userThrow = raw_input ("Enter Rock [r] Paper [p] or Scissors [s]") # raw_input () returns a string, and. I am trying to write a little script that will look at a string of text, remove the stop words, then return the top 10 most commonly used words in that string as a list. join(drop_values), join the list and pass into str. Under Python ≥ 3. 83 1 1 silver badge 6 6 bronze badges. 3. I already got listC using list comprehension:. tuple (mylist) should be good enough to convert the list to a tuple. Index objects (and therefore any grouped columns) cannot have lists, as these are mutable objects and therefore cannot form a stable index. _dict: TypeError: unhashable type: 'StyleProxy' in python. Connect and share knowledge within a single location that is structured and easy to search. They are unhashable only if they contain at least one mutable item. Why Python TypeError: unhashable type: 'list' Hot Network Questions Exploring the Concept of "No Mind" in Eastern Philosophy: An Inquiry into the Foundations and Implications 1 # Unhashable type (list) 2 my_list = [1, 2, 3] ----> 3 print (hash (my_list)) TypeError: unhashable type: 'list'. graphics. Q&A for work. the list of reference and `candidate' dispaled as below. Behavior of Python Dictionary fromkeys () Method with Mutable objects as values, fromdict () can also be supplied with the mutable object as the default value. 7)1 Answer. For example, if we try to use a list or a numpy. The elements of the iterable will end up as dict keys. dict, set ). items())) df. also, you may check your variable col which it is not defined in your function, this may be a list. If the l_user_type_data is a variable contains a string, you should do: temp_dict = dict () temp_dict [l_user_type_data] = user_type_data result = json. So the way to achieve this is to first convert the dict to a list (which is sliceable). I want group by year and month, then calculate the means,why it has wrong? python; python-2. Hashability makes an. groupby('key4'). str. But in this case, a shallow copy is made of the dictionary, i. This problem in my code that I get a list for each ip address in a dictionary of lists. 1248行6列のデータで学習させようとしています。. xlsm) file and copying some values from it to some other positions in the same file. . This won’t work because a list is an unhashable object. setparams you call BasePlot. str. 5. TypeError: unhashable type: 'list' Is there any way around this. I want group by year and month, then calculate the means,why it has wrong? python; python-2. 4,675 5 5 gold badges 24 24 silver badges 50 50 bronze badges. Teams. It should be corrected as. To fix the TypeError: unhashable type: 'list', use a hashable type like a. 10 environment on Windows. This will return the subset of rows where at least a single cell is a list, which should help you locate the problem. __doc__) Create a new dictionary with keys from iterable and values set to value. del dic [value] Share Improve this answer Follow Let's assume that the "source" dictionary has string as keys and has a list of custom objects per value. 7; dictionary; Share. If you are sure that this code worked in Python 2, print results to see its content. but it has an error: TypeError: unhashable type: 'list'. compile_channels (channels) if channel in channel_list: a. From your sample dataframe, it appears your airline series consists of list objects. DataFrame'> RangeIndex: 4637 entries, 0 to 4636. That’s because the hash value of an object must remain constant during its lifetime. # Additional Resources. sum ()Error: unhashable type: 'dict' with Django and API data. Python 3. read_excel ('example. So I was getting dicts and attempting to use those dicts as keys into dicts. words ('english')) description = ("This is. That cannot be done because, as the traceback clearly states, you cannot hash a list type (meaning you. Pandas: Unhashable type list Hot Network Questions Is the expectation of a random vector multiplied by its transpose equal to the product of the expectation of the vector and that of the transposeFix TypeError: unhashable type: ‘list’ in Python . ', '') data2 = data2. TypeError: unhashable type: 'list' I've tried for over an hour to try to troubleshoot this error, but haven't. append (value) Please don't use dict as a variable name; you are shadowing the built-in type by doing that. In the first example (without `lru_cache`), calculating the 40th Fibonacci number took approximately 19.