Skip to content

Commit 4a61397

Browse files
Update DataFrame.cs
1 parent 05bfd03 commit 4a61397

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Microsoft.Data.Analysis/DataFrame.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

@@ -504,7 +504,7 @@ public DataFrame Append(IEnumerable<DataFrameRow> rows, bool inPlace = false, Cu
504504
/// <remarks>If <paramref name="row"/> is null, a null value is appended to each column</remarks>
505505
/// <param name="row"></param>
506506
/// <param name="inPlace">If set, appends a <paramref name="row"/> in place. Otherwise, a new DataFrame is returned with an appended <paramref name="row"/> </param>
507-
/// <param name="cultureInfo">culture info for formatting values</param>
507+
/// <param name="cultureInfo">Culture info for formatting values</param>
508508
public DataFrame Append(IEnumerable<object> row = null, bool inPlace = false, CultureInfo cultureInfo = null)
509509
{
510510
if (cultureInfo == null)
@@ -587,8 +587,14 @@ public DataFrame Append(IEnumerable<object> row = null, bool inPlace = false, Cu
587587
/// <remarks>If a column's value doesn't match its column's data type, a conversion will be attempted</remarks>
588588
/// <param name="row">An enumeration of column name and value to be appended</param>
589589
/// <param name="inPlace">If set, appends <paramref name="row"/> in place. Otherwise, a new DataFrame is returned with an appended <paramref name="row"/> </param>
590-
public DataFrame Append(IEnumerable<KeyValuePair<string, object>> row, bool inPlace = false)
590+
/// <param name="cultureInfo">Culture info for formatting values</param>
591+
public DataFrame Append(IEnumerable<KeyValuePair<string, object>> row, bool inPlace = false, CultureInfo cultureInfo = null)
591592
{
593+
if (cultureInfo == null)
594+
{
595+
cultureInfo = CultureInfo.CurrentCulture;
596+
}
597+
592598
DataFrame ret = inPlace ? this : Clone();
593599
if (row == null)
594600
{
@@ -609,7 +615,7 @@ public DataFrame Append(IEnumerable<KeyValuePair<string, object>> row, bool inPl
609615
object value = columnAndValue.Value;
610616
if (value != null)
611617
{
612-
value = Convert.ChangeType(value, column.DataType);
618+
value = Convert.ChangeType(value, column.DataType, cultureInfo);
613619
if (value is null)
614620
{
615621
throw new ArgumentException(string.Format(Strings.MismatchedValueType, column.DataType), column.Name);

0 commit comments

Comments
 (0)