Skip to content
Snippets Groups Projects
Commit a1475eb0 authored by Joscha Rode's avatar Joscha Rode
Browse files

Zeilenumbrüche korrigiert

parent 67985236
No related branches found
No related tags found
No related merge requests found
No preview for this file type
This diff is collapsed.
This diff is collapsed.
%% Cell type:code id:86f8df89-a483-4093-9098-41196f891c64 tags: %% Cell type:code id:86f8df89-a483-4093-9098-41196f891c64 tags:
``` python ``` python
import pandas as pd import pandas as pd
import json import json
``` ```
%% Cell type:code id:b6873712-56e4-46a9-8bec-031093dd28b1 tags: %% Cell type:code id:b6873712-56e4-46a9-8bec-031093dd28b1 tags:
``` python ``` python
table = pd.read_excel("AuD-Inhalt2.xlsx") table = pd.read_excel("AuD-Inhalt2.xlsx")
``` ```
%% Output %% Output
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
ImportError Traceback (most recent call last) ImportError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_3872/3644074374.py in <module> ~\AppData\Local\Temp/ipykernel_4788/3644074374.py in <module>
----> 1 table = pd.read_excel("AuD-Inhalt2.xlsx") ----> 1 table = pd.read_excel("AuD-Inhalt2.xlsx")
2 2
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs) ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs)
309 stacklevel=stacklevel, 309 stacklevel=stacklevel,
310 ) 310 )
--> 311 return func(*args, **kwargs) --> 311 return func(*args, **kwargs)
312 312
313 return wrapper 313 return wrapper
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\io\excel\_base.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, thousands, comment, skipfooter, convert_float, mangle_dupe_cols, storage_options) ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\io\excel\_base.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, thousands, comment, skipfooter, convert_float, mangle_dupe_cols, storage_options)
362 if not isinstance(io, ExcelFile): 362 if not isinstance(io, ExcelFile):
363 should_close = True 363 should_close = True
--> 364 io = ExcelFile(io, storage_options=storage_options, engine=engine) --> 364 io = ExcelFile(io, storage_options=storage_options, engine=engine)
365 elif engine and engine != io.engine: 365 elif engine and engine != io.engine:
366 raise ValueError( 366 raise ValueError(
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\io\excel\_base.py in __init__(self, path_or_buffer, engine, storage_options) ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\io\excel\_base.py in __init__(self, path_or_buffer, engine, storage_options)
1231 self.storage_options = storage_options 1231 self.storage_options = storage_options
1232 1232
-> 1233 self._reader = self._engines[engine](self._io, storage_options=storage_options) -> 1233 self._reader = self._engines[engine](self._io, storage_options=storage_options)
1234 1234
1235 def __fspath__(self): 1235 def __fspath__(self):
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\io\excel\_openpyxl.py in __init__(self, filepath_or_buffer, storage_options) ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\io\excel\_openpyxl.py in __init__(self, filepath_or_buffer, storage_options)
519 passed to fsspec for appropriate URLs (see ``_get_filepath_or_buffer``) 519 passed to fsspec for appropriate URLs (see ``_get_filepath_or_buffer``)
520 """ 520 """
--> 521 import_optional_dependency("openpyxl") --> 521 import_optional_dependency("openpyxl")
522 super().__init__(filepath_or_buffer, storage_options=storage_options) 522 super().__init__(filepath_or_buffer, storage_options=storage_options)
523 523
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\compat\_optional.py in import_optional_dependency(name, extra, errors, min_version) ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\compat\_optional.py in import_optional_dependency(name, extra, errors, min_version)
116 except ImportError: 116 except ImportError:
117 if errors == "raise": 117 if errors == "raise":
--> 118 raise ImportError(msg) from None --> 118 raise ImportError(msg) from None
119 else: 119 else:
120 return None 120 return None
ImportError: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl. ImportError: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl.
%% Cell type:code id:e9481135-3734-45ed-9847-8f9426bd0f00 tags: %% Cell type:code id:e9481135-3734-45ed-9847-8f9426bd0f00 tags:
``` python ``` python
nds = [] nds = []
lks = [] lks = []
``` ```
%% Cell type:code id:a138d20d-4dc3-4eb8-8ebd-71d1fb3f0cbf tags: %% Cell type:code id:a138d20d-4dc3-4eb8-8ebd-71d1fb3f0cbf tags:
``` python ``` python
for row in table.itertuples(): for row in table.itertuples():
nds.append({'id':row[1], 'name':row[5], 'description':row[9], 'type':row[4]}) nds.append({'id':row[1], 'name':row[5], 'description':row[9], 'type':row[4]})
for link in str(row[7]).split(', '): for link in str(row[7]).split(', '):
if link != "nan": if link != "nan":
lks.append({'source':row[1], 'target':int(link)}) lks.append({'source':row[1], 'target':int(link)})
``` ```
%% Cell type:code id:c06e658c-33d1-4ba8-8a47-ae857984d6ce tags: %% Cell type:code id:c06e658c-33d1-4ba8-8a47-ae857984d6ce tags:
``` python ``` python
result = {'nodes':nds, 'links':lks} result = {'nodes':nds, 'links':lks}
``` ```
%% Cell type:code id:565d11cd-47b6-402e-a734-b4b8a5a66181 tags: %% Cell type:code id:565d11cd-47b6-402e-a734-b4b8a5a66181 tags:
``` python ``` python
result jr = json.dumps(result, ensure_ascii = False)
``` ```
%% Cell type:code id:841e41aa-edcf-4b6a-b946-e4696b9e5ddc tags: %% Cell type:code id: tags:
``` python ``` python
print(jr.replace('\\n','<br>'))
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment