将标题重写为:如何将pandas数据框的“unnamed 0”列的数据类型从int64转换为字符串或对象
P粉536532781
P粉536532781 2023-09-04 20:00:13
0
1
465
<p>我正在进行一个小项目,尝试将pandas的数据框发送到mysql数据库。</p> <p>我的数据框包含默认的未命名列,我想将其发送到mysql服务器。我的sql模式包含一个varchar(255)数据类型的id列。</p> <pre class="brush:php;toolbar:false;">create table users_sample( id varchar(255) NOT NULL PRIMARY KEY, #other_columns)</pre> <p>当我尝试将代码发送到服务器时,出现以下错误</p> <blockquote> <p>sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1364, &quot;字段'id'没有默认值&quot;)</p> </blockquote> <p>当我搜索解决方案时,建议将数据类型从varchar更改为int,并添加auto_increment约束。</p> <p>请提供解决方案。</p><p> 提前感谢。</p>
P粉536532781
P粉536532781

Antworte allen(1)
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!