为什么在输出文件中新的循环中,第1行(原本的第7行)被删除了
时间: 2024-04-08 18:36:30 浏览: 16
根据你之前提供的代码片段,我无法为什么第一行(原本的第7行)会在输出文件中被删除。取的`subset`应该只是原始DataFrame中选择了每六行的,并没有删除任何行。
请确保循环之前,`dataFrame`是加载并包含了所有的数据。同时,查一下循环后对`subset`处理是否会导致删除第一行的况。
如果你能提供更详的代码和示例输入数据,我可以更准确地帮助你找到问题所在。
相关问题
linux中 监控文件夹,却无法检测到在文件夹中新创建的文件
在Linux操作系统中,监控文件夹也可能无法直接检测到新创建的文件,这是因为文件夹监控器(如inotify)只能检测到已经存在的文件和目录的更改,而不是文件夹中新增加的文件。
为了解决这个问题,您可以考虑使用一个循环来检查文件夹中是否有新的文件被创建。以下是一个使用循环的示例代码:
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/inotify.h>
#define EVENT_SIZE (sizeof (struct inotify_event))
#define BUF_LEN (1024 * (EVENT_SIZE + 16))
int main(int argc, char* argv[])
{
int length, i = 0;
int fd;
int wd;
char buffer[BUF_LEN];
fd = inotify_init();
if (fd < 0) {
perror("inotify_init");
}
wd = inotify_add_watch(fd, "/path/to/watch", IN_CREATE);
if (wd < 0) {
perror("inotify_add_watch");
}
while (1) {
i = 0;
length = read(fd, buffer, BUF_LEN);
if (length < 0) {
perror("read");
}
while (i < length) {
struct inotify_event *event = (struct inotify_event *) &buffer[i];
if (event->mask & IN_CREATE) {
printf("New file %s created.\n", event->name);
}
i += EVENT_SIZE + event->len;
}
}
(void) inotify_rm_watch(fd, wd);
(void) close(fd);
return 0;
}
```
该代码可以监控"/path/to/watch"文件夹,并在该文件夹中创建新文件时发出通知。
当然,这种方法可能会带来一些性能问题,因为它需要定期扫描整个目录树。如果您对性能有更高的要求,可以考虑使用更高级的监控工具,如fswatch。
希望这些信息可以对您有所帮助。如果您有任何其他问题或需要进一步的帮助,请随时问我。
在pom文件中新加一个build
可以在 pom.xml 文件中添加如下代码,来定义一个 build:
```xml
<build>
<plugins>
<!-- 插件列表 -->
</plugins>
</build>
```
在 plugins 中添加插件,例如添加 Maven Compiler 插件,可以这样写:
```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
```
这样就定义了一个简单的 build,其中使用了 Maven Compiler 插件,并指定了编译的源码版本和目标版本。
相关推荐
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)