Dela via


DataFrame.LoadCsv Method

Definition

Overloads

LoadCsv(Stream, Char, Boolean, String[], Type[], Int64, Int32, Boolean, Encoding, Boolean, CultureInfo)

Reads a seekable stream of CSV data into a DataFrame.

LoadCsv(String, Char, Boolean, String[], Type[], Int32, Int32, Boolean, Encoding, Boolean, CultureInfo)

Reads a text file as a DataFrame.

LoadCsv(Stream, Char, Boolean, String[], Type[], Int64, Int32, Boolean, Encoding, Boolean, CultureInfo)

Reads a seekable stream of CSV data into a DataFrame.

public static Microsoft.Data.Analysis.DataFrame LoadCsv (System.IO.Stream csvStream, char separator = ',', bool header = true, string[] columnNames = default, Type[] dataTypes = default, long numberOfRowsToRead = -1, int guessRows = 10, bool addIndexColumn = false, System.Text.Encoding encoding = default, bool renameDuplicatedColumns = false, System.Globalization.CultureInfo cultureInfo = default);
static member LoadCsv : System.IO.Stream * char * bool * string[] * Type[] * int64 * int * bool * System.Text.Encoding * bool * System.Globalization.CultureInfo -> Microsoft.Data.Analysis.DataFrame
Public Shared Function LoadCsv (csvStream As Stream, Optional separator As Char = ',', Optional header As Boolean = true, Optional columnNames As String() = Nothing, Optional dataTypes As Type() = Nothing, Optional numberOfRowsToRead As Long = -1, Optional guessRows As Integer = 10, Optional addIndexColumn As Boolean = false, Optional encoding As Encoding = Nothing, Optional renameDuplicatedColumns As Boolean = false, Optional cultureInfo As CultureInfo = Nothing) As DataFrame

Parameters

csvStream
Stream

stream of CSV data to be read in

separator
Char

column separator

header
Boolean

has a header or not

columnNames
String[]

column names (can be empty)

dataTypes
Type[]

column types (can be empty)

numberOfRowsToRead
Int64

number of rows to read not including the header(if present)

guessRows
Int32

number of rows used to guess types

addIndexColumn
Boolean

add one column with the row index

encoding
Encoding

The character encoding. Defaults to UTF8 if not specified

renameDuplicatedColumns
Boolean

If set to true, columns with repeated names are auto-renamed.

cultureInfo
CultureInfo

culture info for formatting values

Returns

DataFrame

Applies to

LoadCsv(String, Char, Boolean, String[], Type[], Int32, Int32, Boolean, Encoding, Boolean, CultureInfo)

Reads a text file as a DataFrame.

public static Microsoft.Data.Analysis.DataFrame LoadCsv (string filename, char separator = ',', bool header = true, string[] columnNames = default, Type[] dataTypes = default, int numRows = -1, int guessRows = 10, bool addIndexColumn = false, System.Text.Encoding encoding = default, bool renameDuplicatedColumns = false, System.Globalization.CultureInfo cultureInfo = default);
static member LoadCsv : string * char * bool * string[] * Type[] * int * int * bool * System.Text.Encoding * bool * System.Globalization.CultureInfo -> Microsoft.Data.Analysis.DataFrame
Public Shared Function LoadCsv (filename As String, Optional separator As Char = ',', Optional header As Boolean = true, Optional columnNames As String() = Nothing, Optional dataTypes As Type() = Nothing, Optional numRows As Integer = -1, Optional guessRows As Integer = 10, Optional addIndexColumn As Boolean = false, Optional encoding As Encoding = Nothing, Optional renameDuplicatedColumns As Boolean = false, Optional cultureInfo As CultureInfo = Nothing) As DataFrame

Parameters

filename
String

filename

separator
Char

column separator

header
Boolean

has a header or not

columnNames
String[]

column names (can be empty)

dataTypes
Type[]

column types (can be empty)

numRows
Int32

number of rows to read

guessRows
Int32

number of rows used to guess types

addIndexColumn
Boolean

add one column with the row index

encoding
Encoding

The character encoding. Defaults to UTF8 if not specified

renameDuplicatedColumns
Boolean

If set to true, columns with repeated names are auto-renamed.

cultureInfo
CultureInfo

culture info for formatting values

Returns

DataFrame

Applies to