dataset

How to Randomly Assign to Groups of Different Sizes

点点圈 提交于 2019-12-11 14:47:35
问题 Say I have a dataset and I want to assign observations to different groups, the size of groups determined by the data. For example, suppose that this is the data: sysuse census, clear keep state region pop order state pop region decode region, gen(reg) replace reg="NCntrl" if reg=="N Cntrl" drop region *Create global with regions global region NE NCntrl South West *Count the number in each region bys reg (pop): gen reg_N=_N tab reg There are four reg groups, all of different sizes. Now, I

DataGridView not displaying data while DataSet contains the data

只愿长相守 提交于 2019-12-11 13:05:45
问题 In the following code, I can see that my DataSet is already filled with data but my DataGridView displays nothing: string sql = "SELECT * FROM MyTable"; try { ds = new DataSet("Downloads"); using (IDbConnection conn = dataFactory.GetDbConnection()) { conn.ConnectionString = Common.Conf.ConnectionString; da = dataFactory.GetDbDataAdapter(); IDbCommand cmd = dataFactory.GetDbCommand(); cmd.CommandText = sql; cmd.Connection = conn; da.SelectCommand = cmd; conn.Open(); da.Fill(ds); conn.Close();

Crosstab two columns under one column header Crystal Report

心已入冬 提交于 2019-12-11 12:41:51
问题 I want to create a report like in crystal report cross tab. The Table has the following data . I can get the report with three expected columns like SELF, 50% and 75%. and their output look like But my requirement is to use Increases and NPCalculated Columns under Main Column as mentioned in pic 1 above. Note: I used the NPCalculated in Summarized Fields but It gives me out like NPCalculated Value comes under Increases Value but It should be side by side as per my requirement. 回答1: First I

How to wire a middle tier of Objects to a data tier consisting of a DataSet?

喜你入骨 提交于 2019-12-11 12:15:32
问题 I have a middle tier containing several related objects and a data tier that is using a DataSet with several DataTables and relationships. I want to call a Save method on one of my objects (a parent object) and have its private variable data transformed into a DataRow and added to a DataTable. Some of the private variable data are actually other objects (child object) that each need to have their own Save method called and their own variable data persisted. How do I "lace" this together? What

Best method for Binding ComboBox

£可爱£侵袭症+ 提交于 2019-12-11 12:03:17
问题 I am going to be developing a large project which will include a large number of ComboBoxes. Most of these combo boxes will be bound to a database field which is a related to another daataset/table. For instance. I have the following 2 tables : Company {CompanyID, CompanyName, MainContact} Contacts {ContactID, ContactName} And when the user clicks to edit a company, A TextBox will be there to edit a company name, but also a ComboBox will be there. The way I am currently doing it is binding

Rolling sum in Matlab

僤鯓⒐⒋嵵緔 提交于 2019-12-11 11:46:03
问题 I have an cross-sectional array with columns as prices for each date. I want to create another array with a rolling sum for window of 30 days. I would prefer not to use a for loop. Currently, I am using the following code for one column: for i=31:n for j=i-30:i-1 x = x + y(j) end sum(i) = x end I need to this for all securities and thus the code will have to run multiple times for all elements in a dataset. 回答1: Use a combination of cumsum 's! data = 1:10; n = length(data); window = 3;

Filling missing data in a data set

二次信任 提交于 2019-12-11 11:18:21
问题 I have a data set like the following: x= [1, 4, 10] y= [10, 20, 30] ( x and y are value pairs, i.e. (1,10), (4,20), (10,30) ) I would like to fill the x values gaps and get linear interpolated values for y . The linear interpolation should be done between each value pair, i.e. between (1,10) and (4,20) and then again between (4,20) and (10,30) . x= [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] y= [10,?, ?, 20, ?, ?, ?, ?, ?, 30] How can I solve this with MATLAB? Regards, Dennis P.S. My original data set

How to combine two DataSet Tables into one

我的未来我决定 提交于 2019-12-11 11:09:37
问题 I am attempting to do as stated above combing two DataSet.tables into one table. I was wondering if it were possible to do so. I call my stored procedure and it returns my values I set them to a table. (All illustrated below). Tried: Adding both table names in the Mapping section ("Tables", IncomingProductTotals) . Adding both as one table in Mapping Section ("Tables", IncomingProductTotals1) ("Tables", TotalDownTimeResults1) Doing lots of research most I can find is on sql joining tables.

C# DataSet - Retrieving Unique Value based on column

和自甴很熟 提交于 2019-12-11 11:08:34
问题 I'm having some issues trying to retrieve unique values from a DataSet in csharp, is that possible? Actually I'm doing something like this that gets a dataset from a webservice: webService.getInstructions(Username, Password, AppKey).Tables[0].Select(null, "account name asc"); So in this case I get a alphabetical list from the accounts, but there are some duplicated rows in this dataset. Is there any way to make this Dataset return values with unique "account number" and sort it alphabetically

How to find the peak coordinate from dataset

*爱你&永不变心* 提交于 2019-12-11 11:06:13
问题 I have a group of dataset. This is the graph I draw using this dataset. How to find the coordinate of peak value from this dataset? Anyone got good java algorithm regarding this issue? 回答1: For this dataset specifically, I would do the following: Make the data stationary by taking first differences Signal when the data is above some threshold level. You can use a fixed threshold or an adaptive threshold (as in this answer for example) When I use the dataset from this question, for