针对100,000条记录集添加性别列 [英] Adding gender column against 100,000 record set

查看:101
本文介绍了针对100,000条记录集添加性别列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有100,000个穆斯林名字的记录,我想计算男性和女性的年龄百分比;

I have a record of 100,000 Muslim names, i want to calculate the %age of male and female;
is there any way to mention gender in short time via business intelligent logic?

推荐答案

我很困惑.

你怎么能告诉一个人性别的名字?
缺少回问他们没有办法.
无论采用哪种方法,我都认为您会遇到严重的准确性问题.
I am confused.

How can you tell a persons Gender from their name?
Short of going back and asking them there is no way of obtaining this.
I think you would have serious problems of accuracy regardless of the approach taken.


请考虑下表,其中包含以下列:
姓名性别年龄
如果记录存储在数据表中,则可以通过以下方式轻松实现:
Consider the following table, with the following columns:
Name Surname Gender Age
If the records are stored in a data table, this could be easily done by:
DataView dv = new DataView(dtSource);
dv.RowFilter = "Gender = 'M'";
int maleAge = 0;
for (int i = 0; i < dv.Count; ++i)
{
       maleAge += Convert.ToInt32(dv[3]); //where 3 is the person's age
}
double maleAvgAge = maleAge / dv.Count;

dv.RowFilter = "Gender = 'F'";
int femaleAge = 0;
for (int i = 0; i < dv.Count; ++i)
{
       femaleAge += Convert.ToInt32(dv[3]); //where 3 is the person's age
}
double femaleAvgAge = femaleAge / dv.Count;


这篇关于针对100,000条记录集添加性别列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆