Reputation: 7268
I am trying to read the movies.txt using F# CsvTypeProvider using the below mentioned code :
type movies = CsvProvider<"../../movies.csv","/",InferRows=0,HasHeaders=false,IgnoreErrors=true,AssumeMissingValues=true,MissingValues="">
F# is inferring the type for movies type as : FSharp.Data.Runtime.CsvFile<System.Tuple<string,string,string>>
Due to this only the first three column values are being read. I understand that its not a uniform csv file i.e. every row is not having the same number of columns. I wanted to know if this file is right candidate or not for the CsvProvider. Also is there any other type provider which can parse the above mentioned file?
Sample Record
Akira (1988)/Louie, Detroit/Lindsay, Michael (II)/Martin, Dan (II)/Stone, Doug (I)/Blum, Steven Jay/Woren, Dan/Forest, Michael (I)/Wurst, Brad/Akimoto, Yôsuke/Cole, George C./Katô, Masayuki (I)/Prescott, Simon/Reynolds, Mike (I)/Held, Watney/Prince, Derek Stephen/Lembaw, Mike/Ôtake, Hiroshi/Lang, Lex/Kusao, Takeshi/Arakawa, Tarô/Bosch, Johnny Yong (I)/Strong, Sam (I)/Buckley, Ivan/Taggert, Jim/Hirano, Masato/Seth, Joshua/Sholder, Adam/Inagaki, Satoru/Sasaki, Nozomu/Buchholz, Bob/Joyce, Christopher (I)/Sorich, Michael/Hustin, Matthew/Lemay, Lewis/Thornton, Kirk/Nakamura, Tatsuhiko/Staley, Steve (II)/Grant, Dougary/McConnohie, Michael/Pinkham, Guy/Kishino, Yukimasa/Ishida, Tarô/Umezu, Hideyuki/Osborne, Jonathan C./Iwata, Mitsuo/Tanaka, Kazumi/Stellrecht, Skip/Kamifuji, Kazuhiro/Spellos, Peter/Pope, Tony/Lee, Peter (I)/Winant, Bruce/Price, Jamieson/Ikemizu, Michihiro/Clarke, Cam/Oliver, Tony (I)/Rae, Ted/Futamata, Issei/Axelrod, Robert/Murray, Ethan/Gurd Jr., Stanley/Ôkura, Masaaki/Romersa, Joe/Walters, Burt/Kramer, Steve (I)/Kitamura, Kôichi/Mercer, Matthew/Bassett, William/Suzuki, Mizuho/Kelso, Lee/Nitta, Sanshirô/Knight, William (III)/Genda, Tesshô/Wimberger, Kurt P./Plantagenet, Richard/Shioya, Kôzô/Hatch, W.T./MacKenzie, Cody/Bergen, Bob/Frierson, Eddie/Itô, Fukue/Phelan, Julie (III)/Brown, Emily (I)/Lane, Marilyn/Ferhardt, Josil/Darro, Bambi/Fujii, Kayoko/Thornton, Chloe/Ôno, Yuka/Goodson, Barbara/Gee, Jessica/Taylor, Julie Anne/Ruff, Michelle/Koyama, Mami/Tissier, Barbara/Cody, Lara/Fuchizaki, Yuriko/Lee, Wendee/Toyoshima, Masami/Ja Lee, Patricia/Forstadt, Rebecca/Tarulli, Lisa/Fox, Sandy (I)/Marshall, Mona (I)/Sarducci, Tony
Aladdin (1992)/Burton, Corey/Cummings, Jim (I)/Young, Philip/Williams, Robin (I)/Welker, Frank/Adler, Charles (I)/Gottfried, Gilbert/Kane, Brad (I)/Proctor, Phil/Gooch, Bruce/Seale, Douglas/Weinger, Scott/Angel, Jack (I)/Wahl, Chris/Houser, Jerry/Freeman, Jonathan (I)/Clarke, Philip L./Pinney, Patrick/Adler, Bruce/McGowan, Mickie/Taylor, Russi/Derryberry, Debi/Lockwood, Vera/Larkin, Linda/Lynn, Sherry (I)/Darling, Jennifer/Zielinski, Kathy/Salonga, Lea
Records are basically forward slash(/) separated string containing movie name followed by actor names.
Upvotes: 0
Views: 170
Reputation: 10350
Most likely you have a problem with your relative path to movies.csv
. Perhaps it is incorrect, so type provider interprets given path as sample string for row type inference. And as your separator is backslash, it ends up deriving row type from ../../movies.csv
being tuple string*string*string
.
You can either find out what's wrong with your relative path and fix it, or just use the absolute path to your csv file as in the snippet below:
[<Literal>]
let path = @"your absolute path to csv data file"
type Movies = CsvProvider<path,"/",.....>
Upvotes: 2