# 常用python 语法 **Published by:** [KeepLearning](https://paragraph.com/@keeplearning-2/) **Published on:** 2024-01-14 **URL:** https://paragraph.com/@keeplearning-2/python-3 ## Content 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] ## Publication Information - [KeepLearning](https://paragraph.com/@keeplearning-2/): Publication homepage - [All Posts](https://paragraph.com/@keeplearning-2/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@keeplearning-2): Subscribe to updates