首页 \ 问答 \ 如何使用不同的长度为CSV中的值分配索引。(How to assign indexes to values in CSV using different lengths. (Java))

如何使用不同的长度为CSV中的值分配索引。(How to assign indexes to values in CSV using different lengths. (Java))

我正在尝试将两个不同CSV文件中的值对齐到类似索引。 一个CSV每秒钟都有一个unix时间戳,每分钟都有一个。 另外,我需要在不同长度的数据上标记索引。

因此,例如,我需要将指数分为1 - 20(和秒1 - 1200),指数为0,然后是指数21 - 25(1260 - 1500),指数为1,分钟为26 - 42(1560 - 2520),指数为2等

长度将根据我正在使用的数据(可能是包含长度的不同值的数组)而变化,因此我想以编程方式执行此操作。 我不确定如何解决这个问题。 任何帮助将不胜感激。

编辑(希望这有助于澄清一些)

我有一个CSV中的数据,其中包含有关音频的信息,另一个CSV中包含有关生物度量数据的信息。 它们都有一个具有unix时间戳的列。 音频CSV中的数据是每秒一次,生物指标数据是每分钟一次。

我想在CSV中添加一个具有相同索引(或键)值的附加行,以便数据在两个文件之间具有公共链接。 如果我调用索引1,我想从两个索引为1的文件中获取数据。

音频文件的长度将决定键的开始和停止位置。 因此,如果我有一个2分钟长的音频文件,生物指标CSV中的2行将具有0的键,而音频CSV的120行将具有0的键。

如果该音频文件已经3分钟长,则生物度量CSV的前3行将具有0的键,并且音频CSV的前180行将具有0的键。


I'm trying to align values in two different CSV files to like indexes. One CSV has a unix time stamp every second and the other every minute. Additionally I need to mark the indexes pn various lengths of the data.

So for example I would need to mark minutes 1 - 20 (and seconds 1 - 1200) with the index of 0, then minutes 21 - 25 (1260 - 1500) with index 1, minutes 26 - 42 (1560 - 2520) with index 2, etc. etc.

The length will vary depending on the data (possibly an array that holds the different values for the lengths) that I am using so I would like to do this programatically. I'm not sure how to attack this problem. Any help would be greatly appreciated.

Edit (hopefully this helps clarify some)

I have data in one CSV that has information about audio and another that has information about bio-metric data. They will both have a column that has a unix time stamp. The data in the audio CSV is for every second and the bio-metric data is for every minute.

I want to add an additional row to the CSV's that have the same index(or key) value so that the data has a common link between the two files. If I call index 1 I want to get the data from both files that have an index of 1.

The length of an audio file will determine where the keys start and stop. So if I had an audio file that was 2 minutes long, 2 rows in the bio-metric CSV will have a key of 0 and 120 rows of the audio CSV will have a key of 0.

If that audio file had been 3 minutes long the first 3 rows of the bio-metric CSV would have a key of 0 and the first 180 rows of the audio CSV would have the a key of 0.


原文:https://stackoverflow.com/questions/22340439
更新时间:2023-08-18 18:08

最满意答案

如果您有特定流的videoId ,则可以使用未记录的live_stats端点来获取查看者的数量:

https://www.youtube.com/live_stats?v={videoid}

If you have the specific stream's videoId you can use the undocumented live_stats endpoint to get the number of viewers:

https://www.youtube.com/live_stats?v={videoid}

相关问答

更多

相关文章

更多

最新问答

更多
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)
  • 是否可以嵌套hazelcast IMaps?(Is it possible to nest hazelcast IMaps? And whick side effects can I expect? Is it a good Idea anyway?)
  • UIViewAnimationOptionRepeat在两个动画之间暂停(UIViewAnimationOptionRepeat pausing in between two animations)
  • 在x-kendo-template中使用Razor查询(Using Razor query within x-kendo-template)
  • 在BeautifulSoup中替换文本而不转义(Replace text without escaping in BeautifulSoup)
  • 如何在存根或模拟不存在的方法时配置Rspec以引发错误?(How can I configure Rspec to raise error when stubbing or mocking non-existing methods?)
  • asp用javascript(asp with javascript)
  • “%()s”在sql查询中的含义是什么?(What does “%()s” means in sql query?)
  • 如何为其编辑的内容提供自定义UITableViewCell上下文?(How to give a custom UITableViewCell context of what it is editing?)
  • c ++十进制到二进制,然后使用操作,然后回到十进制(c++ Decimal to binary, then use operation, then back to decimal)
  • 以编程方式创建视频?(Create videos programmatically?)
  • 无法在BeautifulSoup中正确解析数据(Unable to parse data correctly in BeautifulSoup)
  • webform和mvc的区别 知乎
  • 如何使用wadl2java生成REST服务模板,其中POST / PUT方法具有参数?(How do you generate REST service template with wadl2java where POST/PUT methods have parameters?)
  • 我无法理解我的travis构建有什么问题(I am having trouble understanding what is wrong with my travis build)
  • iOS9 Scope Bar出现在Search Bar后面或旁边(iOS9 Scope Bar appears either behind or beside Search Bar)
  • 为什么开机慢上面还显示;Inetrnet,Explorer
  • 有关调用远程WCF服务的超时问题(Timeout Question about Invoking a Remote WCF Service)