Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
406 views
in Technique[技术] by (71.8m points)

python - 如何在pydatatable中键入强制转换数据框列?(How to type cast a dataframe column in pydatatable?)

I'm trying to explore datatypes of a frame in pydatatable.

(我正在尝试探索pydatatable中框架的数据类型。)

Here I have a dataframe:

(这里有一个数据框:)

ventas_duda_dt = dt.Frame(
    {"cust_id":[893232.34],"sales":['$123,4532.93'],"profit_perc":['10%']})

and its types:

(及其类型:)

ventas_duda_dt.stypes

and the datatypes of each of these fields as:

(每个字段的数据类型为:)

(stype.float64, stype.str32, stype.str32)

Now I would like to cast three of these columns to int, float, float from float, str, str , here.

(现在,我想将这三列转换为int, float, floatfloat, str, str 。)

How it can be achieved by removing these special symbols ($,,,%) in field values?

(如何通过删除字段值中的这些特殊符号($,,,%)来实现?)

I was going though the documentation, but I couldn't find a reference over there respect to this topic.

(我正在浏览文档,但是在那儿找不到关于该主题的参考。)

  ask by myamulla_ciencia translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...