LCA-ActivityBrowser / activity-browser

GUI for brightway2
GNU Lesser General Public License v3.0
134 stars 50 forks source link

ValueError(f"Shape of passed values is {passed}, indices imply {implied}") #1263

Closed mkvdhulst closed 1 week ago

mkvdhulst commented 3 months ago

Updating AB

What happened?

I tried running a scenario LCA for 5 reference flows, 1 impact category, and 48 scenarios from premise and got the same error as reported in closed issues #820, #1103, and #1122. See below for screenshots of my setup.

Screenshot

In issue #1103 it is mentioned that the error might originate from using reference flows which share the same activity. When removing 3 reference flows to make sure I have unique activities (i.e. keeping the ENTSO-E and NL markets), the scenario LCA was executed successfully. Thus, there remains some bug with not being allowed to run scenario LCAs for multiple reference flows with the same activity name, which is impractical when wanting to perform comparisons.

Relevant errors

Loading Scenario file. This may take a while for large files
<function ScenarioImportWidget.scenario_db_check at 0x000001D87FC30680> -- 0.09399962425231934
<function SuperstructureManager.fill_empty_process_keys_in_exchanges at 0x000001D87F60C040> -- 0.07303071022033691
<function SuperstructureManager.verify_scenario_process_keys at 0x000001D87F60C180> -- 3.1629648208618164
<function SuperstructureManager.check_duplicates at 0x000001D87F60C400> -- 0.5500462055206299
<function SuperstructureManager.check_scenario_exchange_values at 0x000001D87F60C2C0> -- 0.3510003089904785
C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\activity_browser\bwutils\superstructure\manager.py:289: PerformanceWarning: indexing past lexsort depth may impact performance.
  self_referential_production_flows.loc[idx, 'flow type'] = 'production'
<function SuperstructureManager.merge_flows_to_self at 0x000001D87F5EFCE0> -- 11.434001445770264
<function ScenarioImportWidget.sync_superstructure at 0x000001D87FC30540> -- 20.230252027511597
<function ScenarioImportWidget.load_action at 0x000001D87FC30400> -- 459.5294032096863
Current shape and databases in the MetaDataStore:(0, 0)set()
Adding:biosphere3
Adding:ei391_cutoff_IMAGE_SS
Traceback (most recent call last):
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tab.py", line 62, in generate_setup
    new_tab = LCAResultsSubTab(data, self)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tabs.py", line 136, in __init__
    self.setup_tabs()
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tabs.py", line 143, in setup_tabs
    self._update_tabs()
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tabs.py", line 154, in _update_tabs
    tab.update_tab()
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tabs.py", line 634, in update_tab
    self.lca_scores_widget.update_tab()
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tabs.py", line 687, in update_tab
    super().update_tab()
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tabs.py", line 309, in update_tab
    self.update_plot()
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\activity_browser\layouts\tabs\LCA_results_tabs.py", line 693, in update_plot
    df = self.parent.mlca.get_results_for_method(method_index)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\activity_browser\bwutils\superstructure\mlca.py", line 214, in get_results_for_method
    return pd.DataFrame(
           ^^^^^^^^^^^^^
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\pandas\core\frame.py", line 782, in __init__
    mgr = ndarray_to_mgr(
          ^^^^^^^^^^^^^^^
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\pandas\core\internals\construction.py", line 336, in ndarray_to_mgr
    _check_values_indices_shape_match(values, index, columns)
  File "C:\Users\hulstmkvd\Anaconda3\envs\ab_297\Lib\site-packages\pandas\core\internals\construction.py", line 420, in _check_values_indices_shape_match
    raise ValueError(f"Shape of passed values is {passed}, indices imply {implied}")
ValueError: Shape of passed values is (5, 48), indices imply (2, 48)

Operating system

Windows 10

Conda environment

activity-browser          2.9.7              pyhd8ed1ab_0    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
arrow                     1.3.0              pyhd8ed1ab_0    conda-forge
asteval                   0.9.32             pyhd8ed1ab_0    conda-forge
astunparse                1.6.3              pyhd8ed1ab_0    conda-forge
blinker                   1.7.0              pyhd8ed1ab_0    conda-forge
brightway2                2.4.4              pyhd8ed1ab_0    conda-forge
brotli                    1.1.0                hcfcfb64_1    conda-forge
brotli-bin                1.1.0                hcfcfb64_1    conda-forge
brotli-python             1.1.0           py311h12c1d0e_1    conda-forge
brotlicffi                1.1.0.0         py311h12c1d0e_1    conda-forge
bw2analyzer               0.10               pyhd8ed1ab_0    conda-forge
bw2calc                   1.8.2           py311h1ea47a8_0    conda-forge
bw2data                   3.6.6              pyhd8ed1ab_0    conda-forge
bw2io                     0.8.10             pyhd8ed1ab_0    conda-forge
bw2parameters             1.1.0              pyhd8ed1ab_0    conda-forge
bw_migrations             0.2                pyhd8ed1ab_0    conda-forge
bzip2                     1.0.8                hcfcfb64_5    conda-forge
ca-certificates           2024.2.2             h56e8100_0    conda-forge
certifi                   2024.2.2           pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py311ha68e1ae_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
click                     8.1.7           win_pyh7428d3b_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
contourpy                 1.2.0           py311h005e61a_0    conda-forge
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
dill                      0.3.8              pyhd8ed1ab_0    conda-forge
docopt                    0.6.2                      py_1    conda-forge
eidl                      2.0.1              pyhd8ed1ab_0    conda-forge
eight                     1.0.1              pyhd8ed1ab_4    conda-forge
et_xmlfile                1.1.0              pyhd8ed1ab_0    conda-forge
fasteners                 0.17.3             pyhd8ed1ab_0    conda-forge
flask                     3.0.2              pyhd8ed1ab_0    conda-forge
fonttools                 4.50.0          py311ha68e1ae_0    conda-forge
freetype                  2.12.1               hdaf720e_2    conda-forge
future                    1.0.0              pyhd8ed1ab_0    conda-forge
gettext                   0.21.1               h5728263_0    conda-forge
glib                      2.80.0               h39d0aa6_1    conda-forge
glib-tools                2.80.0               h0a98069_1    conda-forge
gst-plugins-base          1.22.9               h001b923_1    conda-forge
gstreamer                 1.22.9               hb4038d2_1    conda-forge
icu                       73.2                 h63175ca_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
importlib-metadata        7.1.0              pyha770c72_0    conda-forge
importlib_metadata        7.1.0                hd8ed1ab_0    conda-forge
inflate64                 1.0.0           py311ha68e1ae_1    conda-forge
intel-openmp              2023.2.0         h57928b3_50497    conda-forge
itsdangerous              2.1.2              pyhd8ed1ab_0    conda-forge
jinja2                    3.1.3              pyhd8ed1ab_0    conda-forge
kiwisolver                1.4.5           py311h005e61a_1    conda-forge
krb5                      1.21.2               heb0366b_0    conda-forge
lcms2                     2.16                 h67d730c_0    conda-forge
lerc                      4.0.0                h63175ca_0    conda-forge
libblas                   3.9.0              20_win64_mkl    conda-forge
libbrotlicommon           1.1.0                hcfcfb64_1    conda-forge
libbrotlidec              1.1.0                hcfcfb64_1    conda-forge
libbrotlienc              1.1.0                hcfcfb64_1    conda-forge
libcblas                  3.9.0              20_win64_mkl    conda-forge
libclang13                18.1.2          default_hf64faad_1    conda-forge
libdeflate                1.20                 hcfcfb64_0    conda-forge
libexpat                  2.6.2                h63175ca_0    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libglib                   2.80.0               h39d0aa6_1    conda-forge
libiconv                  1.17                 hcfcfb64_2    conda-forge
libjpeg-turbo             3.0.0                hcfcfb64_1    conda-forge
liblapack                 3.9.0              20_win64_mkl    conda-forge
libogg                    1.3.4                h8ffe710_1    conda-forge
libpng                    1.6.43               h19919ed_0    conda-forge
libsqlite                 3.45.2               hcfcfb64_0    conda-forge
libtiff                   4.6.0                hddb2be6_3    conda-forge
libvorbis                 1.3.7                h0e60522_0    conda-forge
libwebp                   1.3.2                hcfcfb64_1    conda-forge
libwebp-base              1.3.2                hcfcfb64_0    conda-forge
libxcb                    1.15                 hcd874cb_0    conda-forge
libxml2                   2.10.4               hc3477c8_0    conda-forge
libxslt                   1.1.37               h0192164_0    conda-forge
libzlib                   1.2.13               hcfcfb64_5    conda-forge
lxml                      4.9.2           py311h5942461_0    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
markupsafe                2.1.5           py311ha68e1ae_0    conda-forge
matplotlib-base           3.8.3           py311h6e989c2_0    conda-forge
mkl                       2023.2.0         h6a75c08_50497    conda-forge
mrio_common_metadata      0.2.1              pyhd8ed1ab_0    conda-forge
msys2-conda-epoch         20160418                      1    conda-forge
multiprocess              0.70.16         py311ha68e1ae_0    conda-forge
multivolumefile           0.2.3              pyhd8ed1ab_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
networkx                  3.2.1              pyhd8ed1ab_0    conda-forge
numpy                     1.23.5          py311h95d790f_0    conda-forge
openjpeg                  2.5.2                h3d672ee_0    conda-forge
openpyxl                  3.1.2           py311ha68e1ae_1    conda-forge
openssl                   3.2.1                hcfcfb64_1    conda-forge
packaging                 24.0               pyhd8ed1ab_0    conda-forge
pandas                    2.1.4           py311hf63dbb6_0    conda-forge
pathos                    0.3.2              pyhd8ed1ab_1    conda-forge
patsy                     0.5.6              pyhd8ed1ab_0    conda-forge
pcre2                     10.43                h17e33f8_0    conda-forge
peewee                    3.17.1          py311had142b2_0    conda-forge
pillow                    10.2.0          py311h4dd8a23_0    conda-forge
pint                      0.21               pyhd8ed1ab_0    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
pox                       0.3.4              pyhd8ed1ab_0    conda-forge
ppft                      1.7.6.8            pyhd8ed1ab_0    conda-forge
psutil                    5.9.8           py311ha68e1ae_0    conda-forge
pthread-stubs             0.4               hcd874cb_1001    conda-forge
py7zr                     0.21.0             pyhd8ed1ab_0    conda-forge
pybcj                     1.0.2           py311ha68e1ae_0    conda-forge
pycparser                 2.22               pyhd8ed1ab_0    conda-forge
pycryptodomex             3.19.0          py311ha68e1ae_1    conda-forge
pypardiso                 0.4.6              pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.2              pyhd8ed1ab_0    conda-forge
pyperclip                 1.8.2              pyhd8ed1ab_2    conda-forge
pyppmd                    1.1.0           py311h12c1d0e_0    conda-forge
pyprind                   2.11.2          py311h1ea47a8_1005    conda-forge
pyside2                   5.15.8          py311h2411a93_2    conda-forge
pysocks                   1.7.1              pyh0701188_6    conda-forge
python                    3.11.8          h2628c8c_0_cpython    conda-forge
python-dateutil           2.9.0              pyhd8ed1ab_0    conda-forge
python-tzdata             2024.1             pyhd8ed1ab_0    conda-forge
python_abi                3.11                    4_cp311    conda-forge
pytz                      2024.1             pyhd8ed1ab_0    conda-forge
pyxlsb                    1.0.10             pyhd8ed1ab_0    conda-forge
pyzstd                    0.15.9          py311he5d195f_1    conda-forge
qt-main                   5.15.8              h9e85ed6_20    conda-forge
qt-webengine              5.15.8               h4bf5c4e_4    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
salib                     1.4.8              pyhd8ed1ab_0    conda-forge
scipy                     1.12.0          py311h0b4df5a_2    conda-forge
seaborn                   0.13.2               hd8ed1ab_0    conda-forge
seaborn-base              0.13.2             pyhd8ed1ab_0    conda-forge
setuptools                69.2.0             pyhd8ed1ab_0    conda-forge
setuptools-scm            8.0.4              pyhd8ed1ab_1    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
stats_arrays              0.6.6              pyhd8ed1ab_0    conda-forge
statsmodels               0.14.1          py311h59ca53f_0    conda-forge
tabulate                  0.9.0              pyhd8ed1ab_1    conda-forge
tbb                       2021.7.0             h91493d7_0    conda-forge
texttable                 1.7.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h5226925_1    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tqdm                      4.66.2             pyhd8ed1ab_0    conda-forge
types-python-dateutil     2.9.0.20240316     pyhd8ed1ab_0    conda-forge
typing-extensions         4.10.0               hd8ed1ab_0    conda-forge
typing_extensions         4.10.0             pyha770c72_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
unicodecsv                0.14.1             pyhd8ed1ab_2    conda-forge
unidecode                 1.3.8              pyhd8ed1ab_0    conda-forge
urllib3                   2.2.1              pyhd8ed1ab_0    conda-forge
vc                        14.3                hcf57466_18    conda-forge
vc14_runtime              14.38.33130         h82b7239_18    conda-forge
voluptuous                0.14.2             pyhd8ed1ab_0    conda-forge
vs2015_runtime            14.38.33130         hcb4865c_18    conda-forge
werkzeug                  3.0.1              pyhd8ed1ab_0    conda-forge
wheel                     0.43.0             pyhd8ed1ab_1    conda-forge
whoosh                    2.7.4           py311h1ea47a8_8    conda-forge
win_inet_pton             1.1.0              pyhd8ed1ab_6    conda-forge
wrapt                     1.16.0          py311ha68e1ae_0    conda-forge
xlrd                      2.0.1              pyhd8ed1ab_3    conda-forge
xlsxwriter                3.1.9              pyhd8ed1ab_0    conda-forge
xorg-libxau               1.0.11               hcd874cb_0    conda-forge
xorg-libxdmcp             1.1.3                hcd874cb_0    conda-forge
xz                        5.2.6                h8d14728_0    conda-forge
zipfile-deflate64         0.2.0           py311ha68e1ae_4    conda-forge
zipp                      3.17.0             pyhd8ed1ab_0    conda-forge
zstd                      1.5.5                h12be248_0    conda-forge
romainsacchi commented 2 months ago

This relates to #1273

marc-vdm commented 1 week ago

Closing as resolved in #1280

github-actions[bot] commented 5 days ago

[!NOTE] This issue has been implemented in the new release of Activity Browser 🚀 (version 2.10.0), you can get the new version by updating Activity Browser.

Do you want to be notified of new releases of Activity Browser? Subscribe to our updates mailing list ✉.

🤖 beep boop! I'm a bot and this message was an automated action. If updating does not make sense for this issue, just ignore this.