Question: update all values(zero padding)
coldmu opened this issue · comments
coldmu commented
I want to fill zero-padding.
It is not easy to update all values.
Could you help it? plz...
(Before) df:
col1 | col2 |
---|---|
123 | Paul |
33 | Jane |
(After) df:
col1 | col2 |
---|---|
000123 | Paul |
000033 | Jane |
thank you :)
coldmu commented
I try to use series.Map().
sel2 := sel1.Col("col1")
zeroFill := func(e series.Element) series.Element {
result := e.Copy()
zeroResult := fmt.Sprintf("%06s", result.String())
result.Set(zeroResult)
return series.Element(result)
}
received := sel2.Map(zeroFill)
But I got other problems.. how to change series type.
When I update values, it was removed 0. Because it is still int type...
coldmu commented
I found a solution!!
When I got data, I can handle data type with options.
Like this:
cs = dataframe.ReadHTML(strings.NewReader(htmlUTF8), dataframe.DetectTypes(false), dataframe.DefaultType(series.String))[0]
But I'm still curious how to change series type.
Christian Mang commented
Hi coldmu,
it seems to be an unsolved point.