C#C
C#2y ago
Roach

Microsoft DataFrame example not working

Hello there, I'm trying to understand Microsoft DataFrames for a c# project where I need to sum data of prices of items that have the same names inside a csv(sum costs for each entry of "apple", "banana" etc). In my python version I used pandas for that and pivoted after dropping not needed columns to achieve what I wanted with few lines of code.

But now I'm stuck already trying to follow the examples provided by Microsoft for DataFrames. I tried to copy the code mentioned in the "Combine Data Sources" but I'm getting error that column "id" wouldn't exist. Does someone know how good the Microsoft Website is for getting into DataFrames or is there a better place or solution to achive what I want?

            var ids = new List<Single>() { 1, 2, 3, 4, 5, 6 };
            var bedrooms = new List<Single>() { 1, 2, 3, 2, 3, 1 };

            var idColumn = new SingleDataFrameColumn("Id", ids);
            var bedroomColumn = new SingleDataFrameColumn("BedroomNumber", bedrooms);
            var dataFrame2 = new DataFrame(idColumn, bedroomColumn);

            dataFrame = dataFrame.Merge(dataFrame2, new string[] { "Id" }, new string[] { "Id" });

            DataFrame.SaveCsv(dataFrame, "path\\result.csv", ',');


https://learn.microsoft.com/en-us/dotnet/machine-learning/how-to-guides/getting-started-dataframe
Learn how to use DataFrame to manipulate and prepare data.
Was this page helpful?