我的代码产生以下错误:
AttributeError:“函数”对象没有属性“翻译”
更多细节:
我的代码有什么问题?
import pandas as pd
import numpy as np
from textblob import TextBlob
df_file2= df_file['Repair Details']. apply.translate(from_lang='zh-CN',to ='en')
答案 0 :(得分:0)
您似乎不小心在apply
前插入了一个空格。
更改此:
df_file2= df_file['Repair Details']. apply.translate(from_lang='zh-CN',to ='en')
对此:
df_file2= df_file['Repair Details'].apply.translate(from_lang='zh-CN',to ='en')
答案 1 :(得分:0)
您可能想使用Traceback (most recent call last):
File "my_python.py", line 14, in <module>
from my_tensorflow import run_tensorflow
File ".../run_tensorflow.py", line 62, in <module>
os.environ["CUDA_VISIBLE_DEVICES"]=str(FLAGS.gpu)
File ".../.local/lib/python2.7/site-packages/tensorflow/python/platform/flags.py", line 84, in __getattr__
wrapped(_sys.argv)
File ".../.local/lib/python2.7/site-packages/absl/flags/_flagvalues.py", line 633, in __call__
name, value, suggestions=suggestions)
absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'n'
的{{1}}方法。
假设TextBlob
具有TextBlob对象:
translate