Python 批量插入数据库数据

本文介绍了如何使用Python批量插入数据库数据,包括链接数据库、准备数据及完整代码展示,适用于Python初学者和需要进行数据库操作的开发者。
摘要由CSDN通过智能技术生成

链接数据库

咯咯咯咯咯。。。。(已出过链接文章)

前期准备导入资料

看图:准备所需的数据

在这里插入图片描述

#  自动随机生成坐标
def FrameOfReference(zjy_longitude=None, zjy_latitude=None, radius=None):
    radius_in_degrees = radius / 111300
    coordinates_u = float(random.uniform(0.0, 1.0))
    coordinates_v = float(random.uniform(0.0, 1.0))
    coordinates_w = radius_in_degrees * math.sqrt(coordinates_u)
    coordinates_t = 2 * math.pi * coordinates_v
    coordinates_x = coordinates_w * math.cos(coordinates_t)
    coordinates_y = coordinates_w * math.sin(coordinates_t)
    longitude = coordinates_y + zjy_longitude
    latitude = coordinates_x + zjy_latitude
    # 这里是想保留6位小数
    precision_data = '%.6f' % longitude
    latitude_data = 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值