如何告诉熊猫read_table一列有数值

时间:2019-01-16 16:28:45

标签: python pandas

此问题必须是之前提出的或尚无定论。但是我找不到答案。熊猫 setStyle() { // it enters here console.log(this.existingCustomers) // has the right value console.log(this.nonExistingCustomers) // has the right value for (let i = 0; i < this.existingCustomers.length; i++) { this.lineStyle.push({ // won't enter here "customer": this.existingCustomers[i].customer_name, "color": '#000000' }) } for (let i = 0; i < this.nonExistingCustomers.length; i++) { this.lineStyle.push({ // won't enter here "customer": this.nonExistingCustomers[i].customer_name, "color": '#ff0000' }) } console.log(JSON.stringify(this.lineStyle)) // this is empty } 默认情况下将所有数据(单元格)作为字符串。如何分辨给定列(或所有列)是否具有数值?

1 个答案:

答案 0 :(得分:2)

https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_table.html

pandas.read_table()具有dtype =参数,您可以在其中传递{column_name:dtype_you_want_for_column}的字典