Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if the DataFrame object has no property sort

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

The main content of this article is to explain "what to do if the DataFrame object does not have an attribute sort". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what to do if the DataFrame object has no attribute sort"!

The AttributeError:DataFrame object has no property sort

Solution: change "sort" to "sort_values".

Such as:

C_df_sort=c_df.sort (columns=0,ascending=False)

Change to:

C_df_sort=c_df.sort_values (0descending false) AttributeError DataFrame object does not have a property as a _ matrix

Looking at the documentation of pandas, it is found that the as_matrix attribute is no longer in the new version of pandas.

Solution:

1. Install the old version of pandas

2. Use the following code instead

# df.as_matrix () is rewritten to df.values or import numpy as np np.array (df) # equivalent to df.as_matrix () AttributeError: the "DataFrame" object has no attribute "ix"

Starting with version 1.0.0 of pandas, the Series.ix and DataFrame.ix method has been removed.

Solution: replace it with DataFrame's loc method or iloc method.

At this point, I believe you have a deeper understanding of "DataFrame object without properties sort", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report