
# cache = {
#     "company": {
#         "上汽集团": 1,
#         "欧盟委员会": 13,
#         "欧盟": 8,
#         "欧盟委员会总部大厦一角": 2
#     },
#     "person": {
#         "梅赛德斯": 2,
#         "齐普策": 8,
#         "韦杜姆": 5,
#         "朔尔茨": 7,
#         "冯德莱恩": 1,
#         "布尔茨": 4,
#         "纳吉": 3,
#         "哈贝克": 3,
#         "特斯拉": 2,
#         "莫里永": 1,
#         "维辛": 1,
#         "康松林": 1,
#         "尼古拉斯普瓦捷NiclasPoitiers": 1,
#         "李缘": 1,
#         "伯格": 1,
#         "阿斯拉克伯格AslakBerg": 1,
#         "林燕": 1,
#         "华盛顿": 1,
#         "布鲁盖尔Bruegel": 1,
#         "川普": 1,
#         "哈桑-扎米特": 1,
#         "小鹏": 2,
#         "康逸": 3,
#         "费尔": 1,
#         "埃德加博高": 1,
#         "蔚来": 3,
#         "杜登赫费尔": 3,
#         "赵丁喆": 3,
#         "卢基斯": 1,
#         "斯泰兰蒂斯": 2,
#         "保罗博若思": 1,
#         "海国": 1,
#         "斯特凡德古阿拉": 1,
#         "弗兰克": 1,
#         "施沃佩": 1,
#         "费迪南德": 3,
#         "迪尔克扬杜拉": 1,
#         "米扎克": 1,
#         "帕沃尔安塔利奇": 1,
#         "亚采克米扎克": 1,
#         "弗尔季奥蒂洛": 1,
#         "张晨霖": 1,
#         "基塞伊佐尔坦": 1,
#         "德古阿拉": 3,
#         "明道加斯普": 1,
#         "杜登赫": 1,
#         "奥托尔巴吉": 1,
#         "郭晨": 1,
#         "波罗": 1,
#         "尹栋逊": 1,
#         "颜景辉": 1,
#         "段思瑶": 1,
#         "裴健如": 1,
#         "陈庆": 1,
#         "纳吉马顿": 2,
#         "崔东树": 1,
#         "PatrickHummel": 1,
#         "如蔚": 1,
#         "李斌": 1,
#         "福尔克•维辛": 1,
#         "蔚": 1,
#         "TechWeb": 1,
#         "Suky": 1,
#         "陈继业": 1,
#         "欧方": 1,
#         "齐普策OliverZipse": 1,
#         "康林松OlaKaellenius": 1,
#         "PFA": 1,
#         "ACEA": 1,
#         "希尔德加德": 1,
#         "穆勒HildegardMueller": 1,
#         "阿道夫乌尔索阿道夫": 1,
#         "乌尔索": 1,
#         "马库斯费伯MarkusFerber": 1,
#         "特蕾莎里贝拉TeresaRibera": 1,
#         "福尔克维辛": 2,
#         "辛婧": 1,
#         "殷晓圣": 3,
#         "李若佳": 1,
#         "刘维佳": 1,
#         "萨拉热窝": 1,
#         "专员薇奥莱塔布尔茨": 4,
#         "哈贝克RobertHabeck": 1,
#         "布特克MaximilianButek": 1,
#         "关乌": 1,
#         "布特克": 2,
#         "俄乌": 1,
#         "哈桑": 2,
#         "吕瑟尔斯海姆": 2,
#         "何塞普戈梅斯": 3,
#         "李学军": 2,
#         "刘向": 2,
#         "戈梅斯": 2,
#         "马灿": 2,
#         "克雷希米尔": 2,
#         "康林松": 3,
#         "于荣": 2,
#         "霍尔格格尔克": 3,
#         "陈斌杰": 2,
#         "梁国勇": 3,
#         "李博": 2,
#         "乔纳森博格": 2,
#         "胡加齐": 2,
#         "单玮怡": 2,
#         "林剑": 3,
#         "马克西米利安布特克MaximilianButek": 1,
#         "何亚东": 1,
#         "吕骞": 1,
#         "金瑞庭": 1,
#         "罗知之": 1,
#         "马铭博": 1,
#         "马铭": 1,
#         "梅赛德斯-奔驰": 1,
#         "埃隆马斯克": 1,
#         "罗伯特哈贝克RobertHabeck": 1,
#         "奥拉夫朔尔茨OlafScholz": 1
#     },
#     "location": {
#         "上海市": 4,
#         "北京市": 2,
#         "江西省": 1,
#         "赣州市": 1,
#         "常州市": 2,
#         "武进区": 2,
#         "江苏省": 2
#     },
#     "sentiment": {
#         "负面": 4,
#         "中性": 10,
#         "正面": 10
#     },
#     "time": {
#         "17.4": 2,
#         "6月12日": 6,
#         "12日": 2,
#         "2024年06月14日": 1,
#         "2024年6月3日": 1,
#         "6月13日": 1,
#         "7月4日": 1,
#         "38.1": 1,
#         "2023年2月15日": 1,
#         "6月17日": 3,
#         "60.7": 1,
#         "6月14日": 1
#     }
# }
#
# top_keywords = {keyword_type: sorted(keyword_freq.items(), key=lambda x: x[1], reverse=True)[:10] for
#                     keyword_type, keyword_freq in cache.items()}
# # print(top_keywords)
#
# # 提取前十的关键词
# top_keywords_dict = {keyword_type: [keyword for keyword, freq in keywords] for keyword_type, keywords in
#                          top_keywords.items()}
# print(top_keywords_dict)
#
# industry_result = top_keywords_dict['industry'] if 'industry' in top_keywords_dict else []
# insert_industry = ",".join(industry_result)
# company_result = top_keywords_dict["company"] if "company" in top_keywords_dict else []
# person_result = top_keywords_dict["person"] if "person" in top_keywords_dict else []
# sentiment_result = top_keywords_dict["sentiment"] if "sentiment" in top_keywords_dict else []
# location_result = top_keywords_dict["location"] if "location" in top_keywords_dict else []
# time_result = top_keywords_dict["time"] if "time" in top_keywords_dict else []
# print(f"insert_industry:{insert_industry}")
# insert_company = ",".join(company_result)
# insert_person = ",".join(person_result)
# insert_sentiment = ",".join(sentiment_result)
# insert_location = ",".join(location_result)
# insert_time = ",".join(time_result)
# print(f"insert_company:{insert_company}")
# print(f"insert_person:{insert_person}")
# print(f"insert_sentiment:{insert_sentiment}")
# print(f"insert_location:{insert_location}")
# print(f"insert_time:{insert_time}")
# print(type(insert_industry))
#
# test_none = None
# test_set = set(test_none)
# print(test_set)


# set1 = {'万家小新,迎春,李虹萦,张灏然,王宏志,袁野,谭作钧,习近平,鄂维南,苟坪'}
# set2 = {'孟晚舟,李虹萦,张灏然,习近平,王宏志,鄂维南,张玉卓,谭作钧'}
# # 使用 & 运算符找到交集
# intersection_set = set1 & set2
#
# print(intersection_set)


import json

import json
import pandas as pd

# 假设我们有一个包含int64类型数据的DataFrame
df = pd.DataFrame({'id': [1, 2, 3], 'value': [4, 5, 6]})
df['id'] = df['id'].astype('int64')  # 确保id列是int64类型

# 将DataFrame转换为JSON
# 首先将int64转换为int
df['id'] = df['id'].astype('int')

# 现在可以将DataFrame转换为JSON
json_str = json.dumps(df.to_dict(orient='records'))

print(json_str)




