0
推荐
2693
阅读
matplotlib 中文字体 设置
方法一、修改matplotlibrc配置字体1. 定位matplotlib的字体库路径locate -b '\mpl-data'或者在 python环境下import matplotlib
matplotlib.matplotlib_fname()
/cnn/.pyenv/versions/3.6.5/envs/env3web/lib/python3.6/site-packages/matplotlib/mpl-data
2. 将微软雅黑字体文件msyh.ttf,拷贝到该目录的font...
1
推荐
986
阅读
dataframe 保存csv 中文编码
首行出现的”\ufeff“叫BOM("ByteOrder Mark")用来声明该文件的编码信息.”utf-8“ 是以字节为编码单元,它的字节顺序在所有系统中都是一样的,没有字节序问题,因此它不需要BOM,所以当用"utf-8"编码方式读取带有BOM的文件时,它会把BOM当做是文件内容来处理, 也就会发生类似上边的错误."uft-8-sig"中sig全拼为 s...
0
推荐
1201
阅读
python 查看变量占用内存大小 千分位显示
变量dfimport sys
s=sys.getsizeof(df)
print('{:,}'.format(s))
0
推荐
1090
阅读
python 用 pool 实现并行
map并行from multiprocessing import Pool
# 定义函数,每个子进程执行体
def abc(i):
s=i+1
s.to_csv()
# 定义参数列表
flist = list(range(10000))
# 实例化
pool = Pool(10)
# 通过map把flist里的每个元素,传递给子进程,每个子进程按照传入的参数执行abc函数
pool.map(abc,flist)
# 关闭pool...
0
推荐
5186
阅读
pandas dataframe 用 loc 或 iloc 行列选择
参考pandas详细介绍:https://www.jianshu.com/p/79800cad3656单个索引:选列,得到Series
两个索引:先选列再选行,得到元素本身类型
带冒号的索引:选行,得到DataFrame
df[0] 0列, 得到 Series
df[0][1] 0列1行, 得到 str (所在位置元素本身类型)
df[0][0:2] 0列0~1行, 得到 Series
df...
0
推荐
2772
阅读
Nginx+ uwsgi + flask 显示真实IP
一、在机器1(prod03)上, Nginx反向代理端口7077到机器2(lookalike_server)上Nginx能够配置代理多台服务器,利用upstream实现负载均衡http {
# 1. 在http节点下,加入upstream节点:
# upstream 定义一组 HTTP服务器,这些服务器可以监听不同的端口
upstream lookalike_server {
serv...
0
推荐
1664
阅读
pip install lxml 提示错误 Could not find a version that satisfies the requirement lxml
pip install lxml -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
0
推荐
1795
阅读
python采用cx_Oracle往oracle里插入中文报错 UnicodeEncodeError: 'ascii' codec can't encode characters
查看python编码import sys
sys.getdefaultencoding()
'utf-8'查看oracle数据库编码select userenv('language') from dual;
SIMPLIFIED CHINESE_CHINA.ZHS16GBK解决设置和数据库一致的编码 export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"参考:https://blog.csdn.net/qq_40546896/article/details/...
0
推荐
1350
阅读
python + cx_oracle 向oracle 表中插数据
一条条插数据import cx_Oracle
import numpy as np
conn = cx_Oracle.connect('user/passwd@host/instance')
c = conn.cursor()
x = np.arange(9).reshape((3,3)) # ndarray
z=x.tolist() # ndarray to list
b=[[v] for v in z]
for i in range(10):
c.execute('insert into sales_table (X1,X2) values(:1,:2)'...
0
推荐
987
阅读
PE-TL10安装adb interface驱动
PE-TL10 有两个驱动安装不成功,安装华为手机助手,驱动自动装好,再卸载华为手机助手 安装 python-3.7.3-amd64.exe
0
推荐
1164
阅读
python import 上级目录
https://blog.csdn.net/songbinxu/article/details/80289489
0
推荐
1542
阅读
ImportError: No module named _tkinter 错误解决
问题:跑MASK RCNN代码出错 https://github.com/CharlesShang/FastMaskRCNNpython download_and_convert_data.py 错误提示:If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter环境:Ubuntu: 16.04pyenv + virutalenv+Python: 3.6.5尝试解决过程:1....
1
推荐
1562
阅读
Nginx + uwsgi + flask + 文件上传+运行脚本+下载
参考:https://blog.csdn.net/qq_25730711/article/details/53643758https://blog.csdn.net/eeeeeeeff/article/details/60139676
0
推荐
1306
阅读
python读目录下文件名到list,写到文本文件
import glob
# Get all the pngs in the current directory
file_list = glob.glob('*.png')
with open('image_list.txt', 'w') as file:
for item in file_list:
file.write("%s\n" % item)
2
推荐
2923
阅读
画图 pyecharts
1. 地图慧有logo功能多要钱2. echartsjs3. pyecharts简单 http://pyecharts.org/#/地图 https://github.com/pyecharts/pyecharts图例集锦 https://nbviewer.jupyter.org/github/pyecharts/pyecharts-users-cases/blob/master/notebook-users-cases/notebook-user-cases.ipynbpip install echarts-countr...