1

我正在使用 Python 2.7 和 Pandas Profiling 从数据框中生成报告。以下是我的代码:

import pandas as pd
import pandas_profiling

# the actual dataset is very large, just providing the two elements of the list 
data = [{'polarity': 0.0, 'name': u'danesh bhopi', 'sentiment': 'Neutral', 'tweet_id': 1049952424818020353, 'original_tweet_id': 1049952424818020353, 'created_at': Timestamp('2018-10-10 14:18:59'), 'tweet_text': u"Wouldn't mind aus 120 all-out but before that would like to see a Finch \U0001f4af #PakVAus #AUSvPAK", 'source': u'<a href="http://twitter.com/download/android" rel="nofollow">Twitter for Android</a>', 'location': u'pune', 'retweet_count': 0, 'geo': '', 'favorite_count': 0, 'screen_name': u'DaneshBhope'}, {'polarity': 1.0, 'name': u'kamal Kishor parihar', 'sentiment': 'Positive', 'tweet_id': 1049952403980775425, 'original_tweet_id': 1049952403980775425, 'created_at': Timestamp('2018-10-10 14:18:54'), 'tweet_text': u'@the_summer_game What you and Australia think\nPlay for\n win \nDraw\n or....! #PakvAus', 'source': u'<a href="http://twitter.com/download/android" rel="nofollow">Twitter for Android</a>', 'location': u'chembur Mumbai ', 'retweet_count': 0, 'geo': '', 'favorite_count': 0, 'screen_name': u'kaluparihar1'}]
df = pd.DataFrame(data) #data is a python list containing python dictionaries
pfr = pandas_profiling.ProfileReport(df)
pfr.to_file("df_report.html") 

df_report.html 文件部分截图如下:在此处输入图像描述

正如您在图像中看到的,所有变量中的 Unique(%) 字段都是 0.0,尽管列具有唯一值。

除此之外,“位置”变量中的图表已损坏。值 22、15、4 没有条形图,唯一的条形图仅代表最大值。这发生在所有变量中。

任何帮助,将不胜感激。

4

0 回答 0