python DataFrame数据使用to_stata()导出到stata引发ValueError

时间:2018-03-24 09:56:55

标签: pandas

我使用to_stata()导出我的DataFrame

import UIKit
import PDFKit


class pdfViewController: UIViewController {

    @IBOutlet weak var imageview: UIImageView!
    let me = ViewController()
    override func viewDidLoad() {
        super.viewDidLoad()


    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */
    @IBAction func sendbutton(_ sender: Any)
    {

    }

}

引发ValueError('不支持编写通用对象数组')

我不知道如何继续。

1 个答案:

答案 0 :(得分:0)

通过此link查看答案。

找出属于object类型的列:

list(df.select_dtypes(include=['object']).columns)

将它们转换为其他内容:df['col'] = df['col'].astype(str)