Adding comment as answer since it solved the problem. count is somewhat of a protected keyword in DataFrame API, so naming columns count is dangerous. In your case you could circumvent the error by not using the dot notation, but bracket based column access, e.g.
info["count"]
Answer from LiMuBei on Stack OverflowAdding comment as answer since it solved the problem. count is somewhat of a protected keyword in DataFrame API, so naming columns count is dangerous. In your case you could circumvent the error by not using the dot notation, but bracket based column access, e.g.
info["count"]
Try to get info.count as a function call info.count().
movie_names_df = info.join(movies_df, info.movieId == movies_df.ID, "inner").select(movies_df.title, info.average, info.movieId, info.count()).show()
AttributeError: 'numpy.int64' object has no attribute '_get_object_id'
what is "AttributeError: 'function' object has no attribute 'find'"
Object has no attribute '_get_object_id' - Scripting - Eclipse Capella Forum
Error with BertTokenizerFast: AttributeError - 'function' object has no attribute 'get'
morseCodeM={".-":"A",
"-...":"B",
"-.-.":"C",
"-..":"D",
".":"E",
"..-.":"F",
"--.":"G",
"....":"H",
"..":"I",
".---":"J",
"-.-":"K",
".-..":"L",
"--":"M",
"-.":"N",
"---":"O",
".--.":"P",
"--.-":"Q",
".-.":"R",
"...":"S",
"-":"T",
"..-":"U",
"...-":"V",
".--":"W",
"-..-":"x",
"-.--":"Y",
"--..":"Z",
" / ":" "}
def morseToText(inp):
out=""
while(inp!=" "):
for i in morseCodeM:
if(inp.find(i)!=-1): <-----------------------
out=out+morseCodeM[i]
inp2=list(inp)
inp2[inp.find(i):inp.find(i)+(len(i)-1)]=""
inp="".join(inp2)
return outI honestly don't know whats wrong it just gives the error :"AttributeError: 'function' object has no attribute 'find'" on the line with the arrow .
edit: the code is about converting morse code to text
Answer
The reason it fails is thanks to the __dict__ method. Since the removal of it, everything works fine.
Of course this leads to the next question: How to define custom dict functions for those classes
I couldn't find an answer to this but still want to offer a solution: Define a custom function that takes the required obj as a parameter and then puts the wanted fields into a dict. Not the most elegant solution IMO but it works.
I have removed __dict__, and created get_dict(self) to make my dict through the object without my constructor get problems.