随笔分类 - python -_-
摘要:1.查看Pycharm版本: help->about 2.打开中文插件的下载地址(https://plugins.jetbrains.com/plugin/13710-chinese-simplified-language-pack-eap/versions) 3.下载Pycharm对应版本(Pyc
阅读全文
摘要:import datetimedef pre_date(days=0, base_day=None): if base_day: base_day = base_day.strftime('%Y-%m-%d') else: base_day = datetime.datetime.now().str
阅读全文
摘要:#显示所有列 pd.set_option('display.max_columns', None) #显示所有行 pd.set_option('display.max_rows', None) #设置value的显示长度为100,默认为50 pd.set_option('max_colwidth',
阅读全文
摘要:如果结果集为空,MySQLdb将不会引发异常。此外,cursor.execute()函数还将返回一个长值,即获取的结果集中的行数。因此,如果要检查空结果,可以将代码重写为 rows_count = cursor.execute(query_sql) if rows_count > 0: rs = c
阅读全文
摘要:https://www.bilibili.com/video/BV1Kx411Z7eu?t=750 import pandas as pd import os curren_dir=os.path.dirname(os.path.dirname(__file__)) print(curren_dir
阅读全文
摘要:https://www.jb51.net/article/190126.htm 1、脚本内容如下: 1 2 3 4 5 6 7 8 #删除clear_env.py def __clear_env(): for key in globals().keys(): if not key.startswit
阅读全文
该文被密码保护。
摘要:普通方法: 对列表进行排序,然后根据长度为奇数或者偶数的不同情况计算中位数 def huahua(x): length = len(x) print(length) x.sort() print(x) if (length % 2)== 1: z=length // 2 y = x[z] else:
阅读全文
摘要:pandas读取MySql/SqlServer数据 读取MySql数据1 import MySQLdb2 import pandas as pd4 conn = MySQLdb.connect(host = host,port = port,user = username,passwd = pass
阅读全文
摘要:import re a = '''asdfsafhellopass: 234455worldafdsf ''' b = re.findall('hello(.*?)world',a) c = re.findall('hello(.*?)world',a,re.S|re.I ) print('b is
阅读全文
摘要:学习网址 https://www.bilibili.com/video/BV1L5411W7wD?p=7
阅读全文
摘要:在导入Pandas包时,会报如下错误: ImportError: C extension: No module named 'pandas._libs' not built. If you want to import pandas from the source directory, you ma
阅读全文
摘要:一 https://www.cnblogs.com/YingLai/p/9291768.html cd 到csv文件目录下 df = pd.read_csv('fiename.csv') # 读取csv文件方式一 # 读取csv文件方式er df = open('filename.csv') df.
阅读全文
摘要:from openpyxl import load_workbookimport pandas as pdclass Write_to_excel(): def __init__(self,src,sheet,df): if src is None or sheet is None or df is
阅读全文
摘要:新增参数 https://zhuanlan.zhihu.com/p/56922793 学习网址 """ # @Time : 2021/2/1 15:05 # @Author : Gina Gao # @File : # @Software: PyCharm # @Descript: """ # #
阅读全文
摘要:###字母首写大写L1 = ['AdmIn','anny','LUCY','sandY','wILl'] def normallize(name): return name.capitalize() L2=map(normallize,L1) # L2 = list(map(normallize,L
阅读全文
摘要:分批将结果写入库: start = 0 while True: tmp_list = datas_list[start:start+5000]: self.upsert_sqlserver_data(tmp_list,pre='customize',database=self.sqlserver_c
阅读全文
浙公网安备 33010602011771号