Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What if the DataFrame object has no property sort

Shulou Source: shulou.com Published: 2022-06-01 03:06:11 09月20日 Update

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!

Tags: Properties objects methods what to do content methods learning utility deeper code interest practicality practicality simplicity of operation documentation more friends version matrix equivalence Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei macOS vpn Shulou Information OPPO Reno