常用python 语法
January 14th, 2024

1,注意中括号

df = pd.read_csv(path, parse_dates=['candle_begin_time'])

2,时间修改

df['candle_begin_time'] = df['candle_begin_time'] - pd.Timedelta(hours=8)

3,删掉某一列

df.drop('symbol_type', axis=1, inplace=True)

4,某一列的replace,注意需要加上str

df['symbol'] = df['symbol'].str.replace('USDT', '-USDT')

5,比较两个文件夹

files1 = set(os.listdir(xingbuxing_spot_path))

files2 = set(os.listdir(menglong_spot_path))

unique_to_folder1 = files1 - files2

unique_to_folder2 = files2 - files1

6,文件夹下的所有文件,也可以统计个数,list(files1)

files1 = os.listdir(xingbuxing_spot_path)

7,最左下角数值

df.iloc[-1, 0]

Subscribe to KeepLearning
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.
More from KeepLearning

Skeleton

Skeleton

Skeleton