我在jupyter笔记本中有以下代码:
import h5py
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_hdf('accounting-2018-10-deid.h5', 'table')
df.columns
Out[4]:
Index(['group', 'owner', 'job_number', 'submission_time', 'start_time',
'end_time', 'failed', 'exit_status', 'granted_pe', 'slots',
'task_number', 'maxvmem', 'h_data', 'h_rt', 'highp', 'exclusive',
'h_vmem', 'gpu', 'pe', 'slot', 'wait_time', 'wtime', 'campus'],
dtype='object')
各列的含义:
owner: the owner of a job
group: the group a owner belongs to; a group can have one or more owners
任务是: 对于每个组,列出用户数,并列出所有这些用户(即具有相同“组”字段的用户)。 例如:第1组(4个用户):user2,user32,user41,user56?
我尝试使用groupby(),但没有得到正确的答案。 请帮我。
答案 0 :(得分:0)
这对您有用吗?
import java.io.IOException;
import java.nio.file.*;
import java.util.*;
plugins {
id 'java-library'
id 'application'
id 'distribution'
}
repositories {
jcenter()
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
dependencies {
testImplementation 'junit:junit:4.12'
}
String myMainClass='p.Main'
jar {
manifest {
attributes(
'Main-Class': myMainClass
)
}
}
application {
mainClassName = myMainClass
}
class Hack {
static String[] hack() throws IOException {
System.out.println("Working Directory = "+System.getProperty("user.dir"));
String dir="./.settings";
String name="org.eclipse.jdt.core.prefs";
File file=new File(dir,name);
String[] strings=new String[3];
for(int i=0;i<strings.length;i++)
strings[i]="";
if(file.exists()) System.out.println(file.toString()+" exists.");
else return strings;
List<String> lines=new ArrayList<>();
try {
if(usePath) {
Path path=FileSystems.getDefault().getPath(dir,name);
lines=java.nio.file.Files.readAllLines(path);
} else {
BufferedReader bufferedReader=new BufferedReader(new FileReader(file));
for(String line=bufferedReader.readLine();line!=null;line=bufferedReader.readLine())
lines.add(line);
bufferedReader.close();
}
int index;
for(String line:lines) {
if(line.startsWith("org.eclipse.jdt.core.compiler.compliance")) {
index=line.indexOf("=");
if(index>0) {
System.out.println("compliance: "+line.substring(index+1));
strings[0]=line.substring(index+1);
}
}
if(line.startsWith("org.eclipse.jdt.core.compiler.source=1.8")) {
index=line.indexOf("=");
if(index>0) {
System.out.println("source: "+line.substring(index+1));
strings[1]=line.substring(index+1);
}
}
if(line.startsWith("org.eclipse.jdt.core.compiler.codegen.targetPlatform")) {
index=line.indexOf("=");
if(index>0) {
System.out.println("target: "+line.substring(index+1));
strings[2]=line.substring(index+1);
}
}
}
} catch(Exception e) {
System.out.println("caught: "+e);
}
return strings;
}
public static void main(String[] args) throws IOException {
hack();
}
static boolean usePath;
}
println("java version is: ${JavaVersion.current()}")
String[] strings=Hack.hack();
if(strings[1]!="") {
println 'setting source'
sourceCompatibility = strings[1]
}
if(strings[2]!="") {
println 'setting target'
targetCompatibility = strings[2]
}