© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
23 replies
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", ',');
            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
Getting started with DataFrames - ML.NET
Learn how to use DataFrame to manipulate and prepare data.
Getting started with DataFrames - ML.NET
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Web API Debugging in Microsoft Edge Not Working
C#CC# / help
13mo ago
✅ Not understanding Microsoft Tutorial
C#CC# / help
2y ago
Files not showing in microsoft visual
C#CC# / help
3y ago
✅ Microsoft C#
C#CC# / help
6mo ago