![](/img/trans.png)
[英]AttributeError- 'numpy.ndarray' object has no attribute 'index'
[英]AttributeError: 'numpy.ndarray' object has no attribute 'index' in Python
我想創建一個數據幀的索引等於另一個數據幀的索引。
y_test_proba.index = X_test.index
但它有一個錯誤。
AttributeError: 'numpy.ndarray' object has no attribute 'index'
如何解決這個錯誤?
將數組強制為 Pandas DataFrame 將使您能夠訪問索引。
X_test_df = pandas.DataFrame(X_test)
X_test_df.index
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.