DataFrame.LoadCsv 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
LoadCsv(Stream, Char, Boolean, String[], Type[], Int64, Int32, Boolean, Encoding, Boolean, CultureInfo)
將 CSV 數據的可搜尋數據流讀取到 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
參數
- csvStream
- Stream
要讀取的 CSV 數據數據流
- separator
- Char
數據行分隔符
- header
- Boolean
具有標頭或不具有標頭
- columnNames
- String[]
數據行名稱 (可以是空的)
- dataTypes
- Type[]
數據行類型 (可以是空的)
- numberOfRowsToRead
- Int64
如果存在) ,則表示要讀取的數據列數目不包含標頭 (
- guessRows
- Int32
用來猜測類型的數據列數目
- addIndexColumn
- Boolean
使用數據列索引新增一個數據行
- encoding
- Encoding
字元編碼方式。 如果未指定,預設為UTF8
- renameDuplicatedColumns
- Boolean
如果設定為 true,則會自動重新命名重複名稱的數據行。
- cultureInfo
- CultureInfo
格式化值的文化特性資訊
傳回
適用於
LoadCsv(String, Char, Boolean, String[], Type[], Int32, Int32, Boolean, Encoding, Boolean, CultureInfo)
將文本文件讀取為 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
參數
- filename
- String
filename
- separator
- Char
數據行分隔符
- header
- Boolean
具有標頭或不具有標頭
- columnNames
- String[]
數據行名稱 (可以是空的)
- dataTypes
- Type[]
數據行類型 (可以是空的)
- numRows
- Int32
要讀取的數據列數目
- guessRows
- Int32
用來猜測類型的數據列數目
- addIndexColumn
- Boolean
使用數據列索引新增一個數據行
- encoding
- Encoding
字元編碼方式。 如果未指定,預設為UTF8
- renameDuplicatedColumns
- Boolean
如果設定為 true,則會自動重新命名重複名稱的數據行。
- cultureInfo
- CultureInfo
格式化值的文化特性資訊
傳回
資料框架