- 博客(7)
- 收藏
- 关注
原创 python作hp
import pandas as pdimport matplotlib.pyplot as pltimport statsmodels.api as smdf = pd.read_excel(r"D:\300-数量\营业成本季度hp.xlsx")df.set_index("会计期间", inplace=True)cycle, trend = sm.tsa.filters.hpfilter(df, 1600)df["cycle"] = cycledf["trend"] = trend.
2022-04-20 08:26:46
1390
原创 把两个表里字段相同的取出来,取行业中位数
import pandas as pddf = pd.read_excel(r"D:\200-生活\贫困户.xlsx",dtype={'身份证号': "str"})df1 = df.set_index('身份证号')df2 = pd.read_excel(r"D:\200-生活\房产数据.xlsx",dtype={'身份证号': "str"})df3 = df2.set_index('身份证号')df4 = df1.join(df3,how="inner")print(df4)df4.to.
2022-04-19 21:39:07
511
原创 绘制直方图
df = pd.read_excel(r"D:\300-资产.xlsx")plt.figure(figsize=(20,8),dpi=80)plt.title('Histogram',fontsize=20)lab = [0,10,20,30,40,50,60,70,80,90,100]plt.hist(df["资产总计"],bins=10,density=True,align="mid",color='#FCDAE1')plt.xticks(range(0,110000000000,10000.
2022-04-19 21:31:51
191
原创 计算上市公司的car,利用三因子
import requestsimport pandas as pdimport tushare as tsfrom sklearn.linear_model import LinearRegressionimport matplotlib.pyplot as pltevents = ['2018-06-25', '2020-12-25']df_index = pd.read_excel(r"D:\300-学习\320-首都经贸\323-论文\car计算\SZ综合指数.xlsx")df.
2022-04-19 21:29:07
477
原创 学习python笔记001
def he(a,b,c) : #调用函数,带有参数 return a+b+c #返回和def junzhi(a,b,c) : return he(a,b,c)/3print(junzhi(1,2,3))newdata = {"lang":{"firstline":"python","secondline":"java"}, "price":{"firstline":8000}}print(newdata) #打印字典from pandas i.
2022-04-19 21:24:30
696
原创 得到金叉、死叉日期,绘制均线
import pandas as pdimport tushare as tsimport matplotlib.pyplot as pltpro = ts.pro_api('d2f364f7afefc9f34688f86e66610e07cf1456a6faee3eb951acc9f8')df1 = pro.daily(ts_code='000488.SZ', start_date='20010101', end_date='20211231' )df_stockload = df1.ilo.
2022-04-19 21:20:16
285
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人