小编use*_*464的帖子

将日期转换为数字的公式

我想知道将2013年10月26日的日期转换为41573的公式,如excel中所做的那样.就像10/26/2013如何转换为41573.

excel date number-formatting

19
推荐指数
2
解决办法
15万
查看次数

Mapreduce组合器

我有一个简单的mapreduce代码,包括mapper,reducer和combiner.mapper的输出传递给组合器.但是对于reducer而言,不是来自组合器的输出,而是传递mapper的输出.

请帮助

码:

package Combiner;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.Mapper.Context;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;

public class AverageSalary
{
public static class Map extends  Mapper<LongWritable, Text, Text, DoubleWritable> 
{
    public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException 
    {    
        String[] empDetails= value.toString().split(",");
        Text unit_key = new Text(empDetails[1]);      
        DoubleWritable salary_value = new DoubleWritable(Double.parseDouble(empDetails[2]));
        context.write(unit_key,salary_value);    

    }  
}
public static class Combiner extends Reducer<Text,DoubleWritable, Text,Text> …
Run Code Online (Sandbox Code Playgroud)

java hadoop mapreduce

10
推荐指数
2
解决办法
2万
查看次数

使用python将tsv文件转换为xls/xlsx

我想将tsv格式的文件转换为xls/xlsx ..

我试过用

os.rename("sample.tsv","sample.xlsx")
Run Code Online (Sandbox Code Playgroud)

但是转换的文件已损坏.有没有其他方法呢?

python xls file-conversion tsv

5
推荐指数
2
解决办法
5505
查看次数

MRUnit在hbase Result对象中传递值

我正在使用MRUnit测试我的映射器。我正在传递键和值列表作为测试类向映射器的输入。问题是 :

String key=1234_abc;
ArrayList<KeyValue> list = new ArrayList<KeyValue>();
KeyValue k1 = new KeyValue(Bytes.toBytes(key),"cf".getBytes(), "Val1".getBytes(),Bytes.toBytes("abc.com"));
KeyValue k2 = new KeyValue(Bytes.toBytes(key), "cf".getBytes(), "Val2".getBytes(),Bytes.toBytes("165"));
Result result = new Result(list);
mapDriver.withInput(key, result); 
Run Code Online (Sandbox Code Playgroud)

问题在于,在结果对象中仅保留了第一个键值。其他被存储为空。

java hbase mrunit

0
推荐指数
1
解决办法
767
查看次数