Comments (9)
Yeah, it would be a logical thing to provide, and I've thought it through before, but I've not seen a way to preserve the types for a column. In other words you'd wind up with a Seq[Any]
after retreiving the column by header.
If you can think of a way around this limitation I'd be keen to implement the feature.
from product-collections.
What about introducing a class that extends ColSeq and has val headers:Seq[String] and some extra methods?
from product-collections.
Yeah, that's easily doable...
On 19 Apr 2015 10:41, Anton Kulaga [email protected] wrote:What about introducing a class that extends ColSeq and has val headers:Seq[String] and some extra methods?
—Reply to this email directly or view it on GitHub.
from product-collections.
Once again though if one wants to return a column the interface is going to have to be Map[String, Any]
. I can probably do this in CollSeq not CollSeqN which makes things quite simple.
from product-collections.
I mean Seq[Any]
of course...
from product-collections.
Yes, the issue is not simple. I think it can be discussed in gitter as I see several alternative ways to solve it
from product-collections.
Maybe tomorrow, I'm off to lunch shortly which in this country invariably involves the drinking of wine,..
from product-collections.
I do not like Seq[Any] I think we can get more by using case classes together with macro annotations. So, if you know the structure of csv file, then instead of ColSeq[String,String...ntype] you can create a case class. Here is a PR that does this #32
from product-collections.
I'm gonna separate this issue into two: Issue one deals with header support in CollSeq. I've put together a feature branch to deal with this branch: collseq-headers
The macro approach to a Seq of case classes #32 needs it own issue I think.
I've done some preliminary work on collseq-headers:
scala> val csv ="""a,b,c
| 1,2,3
| 4,5,6"""
csv: String =
a,b,c
1,2,3
4,5,6
scala> CsvParser[Int,Int,Int].parse(new java.io.StringReader(csv),hasHeader=true)
res0: com.github.marklister.collections.immutable.CollSeq3[Int,Int,Int] =
a,b,c
CollSeq((1,2,3),
(4,5,6))
scala> res0.collMap("b")
res1: Seq[Any] = List(2, 5)
scala> res0.collMap
res2: Map[String,Seq[Any]] = Map(a -> List(1, 4), b -> List(2, 5), c -> List(3, 6))
scala> res0.collMap("b")
res3: Seq[Any] = List(2, 5)
scala> res0.collMap("c")
res4: Seq[Any] = List(3, 6)
from product-collections.
Related Issues (20)
- Publish feature release including CsvParser.iterator and Utils.CsvOutput HOT 1
- CsvOutput prevents Stream GC HOT 3
- No way to set "None" string to "NA" or "N/A" HOT 12
- Missing GeneralConverter for Option[Long] HOT 5
- Improve error messages when no converter available.
- Add a way to drop header rows when parsing CSV. HOT 3
- unify csv parsers HOT 1
- Not thread-safe HOT 7
- Parse a Try[_] directly
- Drop ProductN, return only Tuples
- Allow carriage return as end-of-line character HOT 3
- 1.4.3 artifacts for Scala 2.10.6 HOT 3
- CSVParser fails on vi Edior generated files HOT 2
- 2.12.0 support HOT 3
- support very generic parsing HOT 3
- Publish 1.4.5 artifacts for scala 2.10 HOT 1
- several delimiters HOT 1
- Optional value quotation
- publish for scala 2.13.0-M5 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from product-collections.