0

Using apache-arrow js (https://github.com/apache/arrow/tree/master/js), I can read arrow file (or even feather file) by a few lines only.

  const arrow = fs.readFileSync("test.feather");
  const table = apArrow.Table.from([arrow]);

However I found that the trailing zero are being removed.

In python dataframe (original data)

4.185771942138672,2019-12-02,2019-12-01,0.0
4.185771942138672,2019-12-03,2019-12-02,1.2

After reading with arrow-js library:

4.185771942138672,2019-12-02,2019-12-01,0
4.185771942138672,2019-12-03,2019-12-02,1.2

Is there any way to avoid the trailing zero being removed?

==== Update ====

Supplement the reason behind asking this question: I would like to compare the data between python Dataframe and the one read from/ export by arrow-js and make sure the output from js are exactly same with the one in python dataframe. Currently it is hard to do the (apple-to-apple) comparison since many rows shown difference due to this trailing zero issue

appletabo
  • 239
  • 2
  • 12
  • 2
    Numerically, the two are the same. Can you clarify *why* you want to do this? Is this just a question of displaying `0` as `0.0`? –  Apr 29 '21 at 10:06
  • for calculation there is no difference if you will have `0.0` or `0` so I wouldn't waste time for this. – furas Apr 29 '21 at 11:19
  • @ChrisG Since I would like to compare the data between python Dataframe and the one read from/ export by arrow-js and make sure the output from js are exactly same with the one in python dataframe. Currently it is hard to do the (apple-to-apple) comparison since many rows shown difference due to this trailing zero issue – appletabo Apr 30 '21 at 01:18
  • How exactly are you comparing them currently? Can you show the relevant code? Because I imagine splitting a line like that by the commas and parsing the numbers first if they differ in length is easy. –  Apr 30 '21 at 06:25

0 Answers0