import pandas as pd
def first(df):
#流通市值 30 45 60 90 120 日均价 以及在4日内高点发生回撤时候的比率
df['lt']=df['amount']/(1000000*df['turn'])
df['hc30']=(df['high']-df['p30'])/df['p30']
df['hc45']=(df['high']-df['p45'])/df['p45']
df['hc60']=(df['high']-df['p60'])/df['p60']
df['hc90']=(df['high']-df['p90'])/df['p90']
df['hc120']=(df['high']-df['p120'])/df['p120']
is_pivot_high = df['high'] == df['high'].rolling(window=5, center=True).max()
high_df = df[is_pivot_high][['mcode','date','open','close','low','high','p30','p45','p60','p90','p120','amount','turn','lt','hc30','hc45','hc60','hc90','hc120']]
return high_df
results=[]
# 执行每个
results.append(first(df))
final_df=pd.concat(results,ignore_index=True)
final_df.to_csv("xxx.csv",index=False,encoding="utf-8-sig")
-
近期文章
近期评论
- admin 发表在《PDF文件分割图片》
- admin 发表在《混乱的五月即将告以段路》
- admin 发表在《系规看来不是300页那么简单》
- admin 发表在《系规看来不是300页那么简单》
- admin 发表在《扩展计划UserScript》
归档
- 2026 年 6 月
- 2026 年 5 月
- 2026 年 4 月
- 2026 年 3 月
- 2026 年 2 月
- 2026 年 1 月
- 2025 年 12 月
- 2025 年 11 月
- 2025 年 10 月
- 2025 年 9 月
- 2025 年 8 月
- 2025 年 7 月
- 2025 年 6 月
- 2025 年 5 月
- 2025 年 4 月
- 2025 年 3 月
- 2025 年 2 月
- 2025 年 1 月
- 2024 年 12 月
- 2024 年 11 月
- 2024 年 10 月
- 2024 年 9 月
- 2024 年 8 月
- 2024 年 7 月
- 2024 年 6 月
- 2024 年 5 月
- 2024 年 4 月
- 2024 年 2 月
- 2024 年 1 月
- 2023 年 12 月
- 2023 年 11 月
- 2023 年 10 月
- 2022 年 10 月
- 2022 年 9 月
- 2022 年 8 月
- 2022 年 7 月
- 2022 年 6 月
- 2022 年 5 月
- 2022 年 4 月
- 2022 年 3 月
- 2022 年 1 月
- 2021 年 11 月
- 2021 年 10 月
- 2021 年 9 月
- 2021 年 4 月
- 2020 年 11 月
- 2020 年 10 月
- 2020 年 8 月
- 2020 年 5 月
- 2020 年 4 月
- 2020 年 1 月
- 2019 年 11 月
- 2019 年 7 月
- 2019 年 2 月
- 2019 年 1 月
- 2018 年 12 月
- 2018 年 11 月
- 2018 年 8 月
分类
友情链接
其他操作