无法排序表格/警告消息

时间:2019-10-19 16:57:50

标签: pandas

以下代码的输出表未排序,尽管我在代码中包括了排序。 请查看警告消息

我为不同的数据集运行了相同的代码,并且工作正常。 基本上,我想查看所有缺失值按升序排序的列;因此我可以轻松地在顶部看到缺少更多值的列。

import pandas as pd
import numpy as np

location = "DC_Properties.csv"
dc_df = pd.read_csv(location)
dc_df.head(7) #print 7 first rows

total = dc_df.isnull().sum().sort_values(ascending=False)
percent_1 = dc_df.isnull().sum()/dc_df.isnull().count()*100
percent_2 = (round(percent_1, 1)).sort_values(ascending=False)
missing_data = pd.concat([total, percent_2], axis=1, keys=['Total', '%'])
missing_data.head(20)`
  

C:\Users\nikil\Anaconda3\lib\site-packages\ipykernel_launcher.py:5: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version of pandas will change to not sort by default. To accept the future behavior, pass 'sort=False'. To retain the current behavior and silence the warning, pass 'sort=True'.

0 个答案:

没有答案
相关问题