Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to download values for figures to reformat externally #86

Closed
zmsubin opened this issue Feb 5, 2024 · 3 comments · Fixed by #87
Closed

Option to download values for figures to reformat externally #86

zmsubin opened this issue Feb 5, 2024 · 3 comments · Fixed by #87

Comments

@zmsubin
Copy link

zmsubin commented Feb 5, 2024

Feature enhancement request: it looks like the "view source" and Vega options only display the axis data but not the values for readily extracting. It would be nice to be able to quickly download the data underlying a comparison timeseries chart so it can be reformatted externally (i.e., without having to install the whole repo).

@zmsubin
Copy link
Author

zmsubin commented Feb 12, 2024

Thanks for adding this; there might be a bug with the json formatting for my comparison chart. I'm getting a json string parsing error:
From browser:
SyntaxError: JSON.parse: unterminated string at line 1 column 72714 of the JSON data
From pandas:
`---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[3], line 1
----> 1 df = pd.read_json(data_dir / 'housing data comparisons.json')
2 df.head()

File /opt/homebrew/Caskroom/miniconda/base/envs/mapping/lib/python3.11/site-packages/pandas/io/json/_json.py:804, in read_json(path_or_buf, orient, typ, dtype, convert_axes, convert_dates, keep_default_dates, precise_float, date_unit, encoding, encoding_errors, lines, chunksize, compression, nrows, storage_options, dtype_backend, engine)
802 return json_reader
803 else:
--> 804 return json_reader.read()

File /opt/homebrew/Caskroom/miniconda/base/envs/mapping/lib/python3.11/site-packages/pandas/io/json/_json.py:1014, in JsonReader.read(self)
1012 obj = self._get_object_parser(self._combine_lines(data_lines))
1013 else:
-> 1014 obj = self._get_object_parser(self.data)
1015 if self.dtype_backend is not lib.no_default:
1016 return obj.convert_dtypes(
1017 infer_objects=False, dtype_backend=self.dtype_backend
1018 )

File /opt/homebrew/Caskroom/miniconda/base/envs/mapping/lib/python3.11/site-packages/pandas/io/json/_json.py:1040, in JsonReader._get_object_parser(self, json)
1038 obj = None
1039 if typ == "frame":
-> 1040 obj = FrameParser(json, **kwargs).parse()
1042 if typ == "series" or obj is None:
1043 if not isinstance(dtype, bool):

File /opt/homebrew/Caskroom/miniconda/base/envs/mapping/lib/python3.11/site-packages/pandas/io/json/_json.py:1173, in Parser.parse(self)
1172 def parse(self):
-> 1173 self._parse()
1175 if self.obj is None:
1176 return None

File /opt/homebrew/Caskroom/miniconda/base/envs/mapping/lib/python3.11/site-packages/pandas/io/json/_json.py:1366, in FrameParser._parse(self)
1362 orient = self.orient
1364 if orient == "columns":
1365 self.obj = DataFrame(
-> 1366 ujson_loads(json, precise_float=self.precise_float), dtype=None
1367 )
1368 elif orient == "split":
1369 decoded = {
1370 str(k): v
1371 for k, v in ujson_loads(json, precise_float=self.precise_float).items()
1372 }

ValueError: Unmatched ''"' when when decoding 'string'`

@zmsubin
Copy link
Author

zmsubin commented Feb 12, 2024

visualization(5)
Here is what the chart looks like, in case this depends on the chart configuration.

@sid-kap
Copy link
Owner

sid-kap commented Feb 12, 2024

Ah sorry, thanks for flagging! I think I've fixed it to handle larger files now (will deploy in the next 10 min)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants