123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- from re import A
- import pandas as pd
- import numpy as np
- from pandas.core.frame import DataFrame
- from scipy import interpolate
- import matplotlib.pyplot as plt
- import bisect
- import datetime,time
- import operator
- from six import b
- import skfuzzy as fuzz
- import skfuzzy.control as ctrl
- import os
- from scipy.interpolate import interp2d
- from apscheduler.schedulers.blocking import BlockingScheduler
- from LIB.MIDDLE.CellStateEstimation.Common import BatParam
- # def fun1():
- # print('job1')
- # print(datetime.datetime.now())
- # time.sleep(3)
- # def fun2():
- # print('job2')
- # print(datetime.datetime.now())
- # time.sleep(3)
- # scheduler = BlockingScheduler()
- # scheduler.add_job(fun1, 'interval', seconds=5)
- # scheduler.add_job(fun2, 'interval', seconds=5)
- # scheduler.start()
-
- # a=8
- # for i in range(a):
- # with open('soc.txt','a') as file:
- # file.write(str(a)+'\n')
- # a=a+1
- # a={'1':123,'2':234,'3':456}
- # b=list(a.values())
- # print(b)
- # print(b[1])
- # a=pd.DataFrame(columns=['a','b'])
- # a['a']=[1,3,1,2,4]
- # a['b']=[1,2,3,4,5]
- # # a=a.sort_values(by='a',ascending=True)
- # a=a.drop('b',axis=1)
- # print(a)
- column_name=['time', 'sn', 'short_current']
- df_res=pd.DataFrame(columns=column_name)
- df_res.loc[1]=[1,1.5,1]
- df_res.loc[2]=[1,-2.5,2]
- df_res.loc[3]=[-1,3.5,3]
- df_res.loc[4]=[3,-4.5,4]
- df_res.reset_index(inplace=True,drop=True) #重置索引
- df_res=df_res[(df_res[['time','sn']]>0) & (df_res[['time','sn']]<3)]
- print(df_res)
- # column_name=['time', 'sn', 'soc']
- # df_res1=pd.DataFrame(columns=column_name)
- # df_res1.loc[1]=[1,1,3.330]
- # df_res1.loc[2]=[1,2,3.330]
- # df=df_res.append(df_res1)
- # print(df)
- # df_res1=pd.DataFrame(columns=column_name)
- # df_res1.loc[1]=[1,1,3.330]
- # df_res.append(df_res1,ignore_index=True)
- # # print(df_res.drop(df_res.loc[df_res['sn']==3].index))
- # print(df_res)
- # import time
- # import datetime
- # from apscheduler.schedulers.blocking import BlockingScheduler
- # def add(a):
- # a=a+1
- # return a
- # def func():
- # #耗时2S
- # global a
- # now = datetime.datetime.now()
- # ts = now.strftime('%Y-%m-%d %H:%M:%S')
- # a=add(a)
- # print('do func2 time:',ts)
- # print(a)
- # # time.sleep(5)
-
-
- # if __name__=="__main__":
- # a=1
- # scheduler = BlockingScheduler()
- # scheduler.add_job(func, 'interval', seconds=1, id='test_job1')
-
- # scheduler.start()
|