# Install required packages
!pip install -q -r requirements.txt
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
WARNING: You are using pip version 20.1.1; however, version 21.0.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
!pip install schrutepy==0.1.2
Requirement already satisfied: schrutepy==0.1.2 in /root/venv/lib/python3.7/site-packages (0.1.2)
Requirement already satisfied: wheel in /usr/local/lib/python3.7/site-packages (from schrutepy==0.1.2) (0.36.2)
Requirement already satisfied: pandas in /shared-libs/python3.7/py/lib/python3.7/site-packages (from schrutepy==0.1.2) (1.2.3)
Requirement already satisfied: twine>=3 in /root/venv/lib/python3.7/site-packages (from schrutepy==0.1.2) (3.3.0)
Requirement already satisfied: ipython>=6 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from schrutepy==0.1.2) (7.21.0)
Requirement already satisfied: pip in /root/venv/lib/python3.7/site-packages (from schrutepy==0.1.2) (20.1.1)
Requirement already satisfied: pytz>=2017.3 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from pandas->schrutepy==0.1.2) (2021.1)
Requirement already satisfied: numpy>=1.16.5 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from pandas->schrutepy==0.1.2) (1.19.5)
Requirement already satisfied: python-dateutil>=2.7.3 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from pandas->schrutepy==0.1.2) (2.8.1)
Requirement already satisfied: setuptools>=0.7.0 in /root/venv/lib/python3.7/site-packages (from twine>=3->schrutepy==0.1.2) (47.1.0)
Requirement already satisfied: rfc3986>=1.4.0 in /root/venv/lib/python3.7/site-packages (from twine>=3->schrutepy==0.1.2) (1.4.0)
Requirement already satisfied: requests-toolbelt!=0.9.0,>=0.8.0 in /root/venv/lib/python3.7/site-packages (from twine>=3->schrutepy==0.1.2) (0.9.1)
Requirement already satisfied: pkginfo>=1.4.2 in /root/venv/lib/python3.7/site-packages (from twine>=3->schrutepy==0.1.2) (1.7.0)
Requirement already satisfied: colorama>=0.4.3 in /root/venv/lib/python3.7/site-packages (from twine>=3->schrutepy==0.1.2) (0.4.4)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from twine>=3->schrutepy==0.1.2) (3.7.0)
Requirement already satisfied: keyring>=15.1 in /root/venv/lib/python3.7/site-packages (from twine>=3->schrutepy==0.1.2) (23.0.0)
Requirement already satisfied: tqdm>=4.14 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from twine>=3->schrutepy==0.1.2) (4.58.0)
Requirement already satisfied: readme-renderer>=21.0 in /root/venv/lib/python3.7/site-packages (from twine>=3->schrutepy==0.1.2) (29.0)
Requirement already satisfied: requests>=2.20 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from twine>=3->schrutepy==0.1.2) (2.25.1)
Requirement already satisfied: backcall in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=6->schrutepy==0.1.2) (0.2.0)
Requirement already satisfied: pexpect>4.3; sys_platform != "win32" in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=6->schrutepy==0.1.2) (4.8.0)
Requirement already satisfied: pygments in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=6->schrutepy==0.1.2) (2.8.0)
Requirement already satisfied: jedi>=0.16 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=6->schrutepy==0.1.2) (0.17.2)
Requirement already satisfied: pickleshare in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=6->schrutepy==0.1.2) (0.7.5)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=6->schrutepy==0.1.2) (3.0.16)
Requirement already satisfied: traitlets>=4.2 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=6->schrutepy==0.1.2) (5.0.5)
Requirement already satisfied: decorator in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=6->schrutepy==0.1.2) (4.4.2)
Requirement already satisfied: six>=1.5 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from python-dateutil>=2.7.3->pandas->schrutepy==0.1.2) (1.15.0)
Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->twine>=3->schrutepy==0.1.2) (3.7.4.3)
Requirement already satisfied: zipp>=0.5 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->twine>=3->schrutepy==0.1.2) (3.4.0)
Requirement already satisfied: jeepney>=0.4.2; sys_platform == "linux" in /root/venv/lib/python3.7/site-packages (from keyring>=15.1->twine>=3->schrutepy==0.1.2) (0.6.0)
Requirement already satisfied: SecretStorage>=3.2; sys_platform == "linux" in /root/venv/lib/python3.7/site-packages (from keyring>=15.1->twine>=3->schrutepy==0.1.2) (3.3.1)
Requirement already satisfied: bleach>=2.1.0 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from readme-renderer>=21.0->twine>=3->schrutepy==0.1.2) (3.3.0)
Requirement already satisfied: docutils>=0.13.1 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from readme-renderer>=21.0->twine>=3->schrutepy==0.1.2) (0.16)
Requirement already satisfied: certifi>=2017.4.17 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from requests>=2.20->twine>=3->schrutepy==0.1.2) (2020.12.5)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from requests>=2.20->twine>=3->schrutepy==0.1.2) (1.26.3)
Requirement already satisfied: chardet<5,>=3.0.2 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from requests>=2.20->twine>=3->schrutepy==0.1.2) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from requests>=2.20->twine>=3->schrutepy==0.1.2) (2.10)
Requirement already satisfied: ptyprocess>=0.5 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from pexpect>4.3; sys_platform != "win32"->ipython>=6->schrutepy==0.1.2) (0.7.0)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from jedi>=0.16->ipython>=6->schrutepy==0.1.2) (0.7.1)
Requirement already satisfied: wcwidth in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=6->schrutepy==0.1.2) (0.2.5)
Requirement already satisfied: ipython-genutils in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from traitlets>=4.2->ipython>=6->schrutepy==0.1.2) (0.2.0)
Requirement already satisfied: cryptography>=2.0 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from SecretStorage>=3.2; sys_platform == "linux"->keyring>=15.1->twine>=3->schrutepy==0.1.2) (3.4.6)
Requirement already satisfied: webencodings in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from bleach>=2.1.0->readme-renderer>=21.0->twine>=3->schrutepy==0.1.2) (0.5.1)
Requirement already satisfied: packaging in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from bleach>=2.1.0->readme-renderer>=21.0->twine>=3->schrutepy==0.1.2) (20.9)
Requirement already satisfied: cffi>=1.12 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from cryptography>=2.0->SecretStorage>=3.2; sys_platform == "linux"->keyring>=15.1->twine>=3->schrutepy==0.1.2) (1.14.5)
Requirement already satisfied: pyparsing>=2.0.2 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from packaging->bleach>=2.1.0->readme-renderer>=21.0->twine>=3->schrutepy==0.1.2) (2.4.7)
Requirement already satisfied: pycparser in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from cffi>=1.12->cryptography>=2.0->SecretStorage>=3.2; sys_platform == "linux"->keyring>=15.1->twine>=3->schrutepy==0.1.2) (2.20)
WARNING: You are using pip version 20.1.1; however, version 21.0.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
# Add any additional libraries or submodules below
# If you do not have schrutepy you can pip install it
from schrutepy import schrutepy
# Display plots inline
%matplotlib inline
# Data libraries
import pandas as pd
import numpy as np
# Plotting libraries
import matplotlib.pyplot as plt
import seaborn as sns
# Plotting defaults
plt.rcParams['figure.figsize'] = (8,5)
plt.rcParams['figure.dpi'] = 80
# sklearn modules
import sklearn
from sklearn.metrics import mean_squared_error
from sklearn.pipeline import make_pipeline
from sklearn.model_selection import GridSearchCV, KFold
# Load data
d = pd.read_csv("/work/the_office (1).csv")
d.head(100)
print(f'The dataframe has missing values or NaN\'s : {d.isnull().values.any()}\n\n')
sns.pairplot(d, y_vars = 'imdb_rating');
The dataframe has missing values or NaN's : False
print('Column datatypes')
print(d.dtypes)
Column datatypes
season int64
episode int64
episode_name object
director object
writer object
imdb_rating float64
total_votes int64
air_date object
n_lines int64
n_directions int64
n_words int64
n_speak_char int64
main_chars object
dtype: object
directors = list(d['director'].unique())
print(d['director'].value_counts())
plt.hist(d['director'].value_counts(),
bins = list(range(1,16)),
ec = 'black');
plt.title('Count of Episodes Directed');
Randall Einhorn 15
Paul Feig 14
Greg Daniels 14
Ken Kwapis 12
Jeffrey Blitz 11
..
Ken Wittingham 1
Paul Lieerstein 1
Amy Heckerling 1
Roger Nygard 1
Daniel Chun 1
Name: director, Length: 61, dtype: int64
#Index directors based on who has directed more than 5 episodes
prominentdirectors = d['director'].value_counts()[d['director'].value_counts() > 5]
#Create a new indicator column for each director in the above list
for director in prominentdirectors.index.tolist() :
d[f'director_{director}'] = (d['director'] == f'{director}').astype(int)
#Writers requires a bit more engineering than directors, as they are stored as strings which can contain multiple names
#The below code creates a list of every in every row, where writers are seperated by a semicolon
all_writers = [i.split(',') for i in d['writer'].tolist() for i in i.split(';')]
#Cast the list back to an array, so we can reuse our previous functions
writers_series = pd.DataFrame(np.array(all_writers))
print(writers_series.value_counts().head(10))
plt.hist(writers_series.value_counts(),
bins = list(range(1,22)),
label = 'Number of Episodes Directed',
ec = 'black');
plt.xticks(list(range(1,22,2)));
plt.title('Count of Episodes Written');
Mindy Kaling 21
Paul Lieberstein 16
Gene Stupnitsky 15
B.J. Novak 15
Lee Eisenberg 15
Greg Daniels 12
Brent Forrester 11
Justin Spitzer 11
Jennifer Celotta 11
Michael Schur 10
dtype: int64
#Filter for 10 or more episdoes written
writers_series = writers_series.value_counts()[writers_series.value_counts() >= 10]
#Pull them from the series into a list
top_10_writers = [x[0] for x in writers_series.keys()]
#Finally create the indicator columns
for writers in top_10_writers :
d[f'writer_{writers}'] = (d['writer'].str.contains(f'{writers}')).astype(int)
#load data
df2 = schrutepy.load_schrute()
#set every character name to lowercase, remove white space and quotation marks. This picks up a lot of the spelling errors
df2['character'] = df2['character'].apply(lambda char : char.lower().replace(' ', '').strip('"'))
#count lines per character and sort by size, take top 25 characters
top_25_characters = list(df2.groupby(['character']).size().sort_values(ascending=False).keys()[0:25])
#Now group df by season and episode, then count lines per character. Then turn that back into a df and drop the index
df2 = df2.groupby(['season', 'episode'])['character'].value_counts().to_frame(name = 'character_lines').reset_index()
#Now pivot the table, so characters are now the columns, seasons and episodes are a multilevel index, and number of lines are the row values
#Finally pull out only columns that are one of our top 25 characters by # of lines
#Note 0's have gone to nan's
df2 = df2.pivot_table(index = ['season', 'episode'], columns = 'character', values = 'character_lines')[top_25_characters]
#set NaNs to 0 and convert floats to integers
df2 = df2.fillna(value = 0).astype(int)
#Finally join this to our original df
d = d.join(df2, ['season', 'episode'])
the_office = d.drop(['episode_name', 'director', 'writer', 'air_date', 'main_chars', 'total_votes', 'episode', 'season'], axis = 1)
the_office
def get_coefs(m):
"""Returns the model coefficients from a Scikit-learn model object as an array,
includes the intercept if available.
"""
# If pipeline, use the last step as the model
if (isinstance(m, sklearn.pipeline.Pipeline)):
m = m.steps[-1][1]
if m.intercept_ is None:
return m.coef_
return np.concatenate([[m.intercept_], m.coef_])
def model_fit(m, X, y, plot = False):
"""Returns the root mean squared error of a fitted model based on provided X and y values.
Args:
m: sklearn model object
X: model matrix to use for prediction
y: outcome vector to use to calculating rmse and residuals
plot: boolean value, should fit plots be shown
"""
y_hat = m.predict(X)
rmse = mean_squared_error(y, y_hat, squared=False)
res = pd.DataFrame(
data = {'y': y, 'y_hat': y_hat, 'resid': y - y_hat}
)
if plot:
plt.figure(figsize=(12, 6))
plt.subplot(121)
sns.lineplot(x='y', y='y_hat', color="grey", data = pd.DataFrame(data={'y': [min(y),max(y)], 'y_hat': [min(y),max(y)]}))
sns.scatterplot(x='y', y='y_hat', data=res).set_title("Fit plot")
plt.subplot(122)
sns.scatterplot(x='y', y='resid', data=res).set_title("Residual plot")
plt.subplots_adjust(left=0.0)
plt.suptitle("Model rmse = " + str(round(rmse, 4)), fontsize=16)
plt.show()
return rmse
from sklearn.model_selection import train_test_split
# Our model matrix X and outcome vector y
X = the_office.drop(['imdb_rating'], axis=1)
y = the_office.imdb_rating
# Obtain a test and train split for both X and y
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
print("orig sizes :", X.shape, y.shape)
print("train sizes:", X_train.shape, y_train.shape)
print("test sizes :", X_test.shape, y_test.shape)
orig sizes : (186, 49) (186,)
train sizes: (148, 49) (148,)
test sizes : (38, 49) (38,)
from sklearn.linear_model import LinearRegression
lm = LinearRegression().fit(X_train, y_train)
model_fit(lm, X_test, y_test, plot=True)
from sklearn.preprocessing import StandardScaler
S = StandardScaler().fit(X)
lm_scaled = make_pipeline(
StandardScaler(),
LinearRegression()
).fit(X_train, y_train)
model_fit(lm_scaled, X_test, y_test, plot=True)
from sklearn.linear_model import Lasso
l = make_pipeline(
StandardScaler(),
Lasso(alpha=0.15)
).fit(X_train, y_train)
print("lasso rmse:", model_fit(l, X_test, y_test, plot=True))
print("lasso coefs:", get_coefs(l))
lasso rmse: 0.5198982188210347
lasso coefs: [ 8.26013514 0. 0. 0. 0. -0.
0. 0. 0. 0. -0. -0.
-0. 0. -0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0.11827045 0. 0. 0. -0.
0. 0. -0. 0. -0. -0.
0. 0. 0. 0. 0. 0.
0. -0.02306017 -0. -0. 0. 0.
0. -0. ]
get_coefs(l)
def find_order_features(A):
"""Returns two lists, one containing all the features in the model matrix X which have nonzero coefficients from the model,
the second containing all the corresponding coefficients, and decreasingly order both lists in terms of the highest
coefficients in the model and corresponding features.
"""
features = []
coefficients = []
indices = []
# Convert array to list
list_all_coef = list(A)
length = len(list_all_coef)
for k in range(1, length):
if list_all_coef[k] != 0:
features.append(X.columns[k-1])
coefficients.append(list_all_coef[k])
indices.append(k)
abs_coefficients = []
for i in range(len(coefficients)):
abs_coefficients.append(abs(coefficients[i]))
feat_coefs = pd.DataFrame(features)
feat_coefs['coefficients'] = coefficients
feat_coefs['abs_coefficients'] = abs_coefficients
#ordered_coefficients = sorted(coefficients, reverse = True)
return (feat_coefs)
find_order_features(get_coefs(l))
alphas = np.linspace(0.01, 1, num=100)
betas = [] # Store coefficients
rmses = [] # Store validation rmses
for a in alphas:
m = make_pipeline(
StandardScaler(),
Lasso(alpha=a)
).fit(X_train, y_train)
# Again ignore the intercept since it isn't included in the penalty
betas.append(get_coefs(m)[1:])
rmses.append(model_fit(m, X_test, y_test))
res = pd.DataFrame(
data = betas, # Coefficients
columns = X.columns # Coefficient names
).assign(
alpha = alphas, # Add alpahs
rmse = rmses # Add validation rmses
).melt(
id_vars = ('alpha', 'rmse') # Move columns into the rows
)
#SORT LEGEND
sns.lineplot(x='alpha', y='value', hue='variable', data=res, legend=False).set_title("Coefficients")
plt.show()
alphas = np.linspace(0.01, 1, num=100)
l_gs = GridSearchCV(
make_pipeline(
StandardScaler(),
Lasso()
),
param_grid={'lasso__alpha': alphas},
cv=KFold(10, shuffle=True, random_state=1234),
scoring="neg_root_mean_squared_error"
).fit(X_train, y_train)
print( "best alpha:", l_gs.best_params_['lasso__alpha'])
print( "best rmse :", l_gs.best_score_ * -1)
print( "validation rmse:", model_fit(l_gs.best_estimator_, X_test, y_test))
best alpha: 0.05
best rmse : 0.42619635501268033
validation rmse: 0.48720333344413724
l_cv_res = pd.DataFrame().assign(
alpha = alphas,
rmse = -1 * l_gs.cv_results_['mean_test_score'], # mean of the rmse over the folds
rmse_se = l_gs.cv_results_['std_test_score'] / np.sqrt(l_gs.n_splits_), # standard error of the rmse
)
plt.figure(figsize=(14, 6))
plt.subplot(121)
sns.lineplot(x='alpha', y='rmse', data=l_cv_res)
plt.subplot(122)
sns.lineplot(x='alpha', y='rmse', data=l_cv_res).set_xscale('log')
best = l_gs.best_params_['lasso__alpha']
l2 = make_pipeline(
StandardScaler(),
Lasso(alpha=best)
).fit(X_train, y_train)
print("lasso rmse:", model_fit(l2, X_test, y_test, plot=True))
print("lasso coefs:", get_coefs(l2))
lasso rmse: 0.48720333344413724
lasso coefs: [ 8.26013514e+00 9.10243858e-04 0.00000000e+00 5.73033143e-02
0.00000000e+00 -0.00000000e+00 0.00000000e+00 1.94599265e-02
0.00000000e+00 -0.00000000e+00 -0.00000000e+00 -0.00000000e+00
-0.00000000e+00 0.00000000e+00 -0.00000000e+00 0.00000000e+00
9.87478341e-03 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00
0.00000000e+00 1.19356720e-01 0.00000000e+00 5.32159146e-02
0.00000000e+00 -0.00000000e+00 0.00000000e+00 0.00000000e+00
-2.71269596e-02 -0.00000000e+00 -0.00000000e+00 -0.00000000e+00
0.00000000e+00 0.00000000e+00 0.00000000e+00 7.45587148e-03
4.29322949e-03 -0.00000000e+00 5.21565625e-03 -1.01562009e-01
-0.00000000e+00 -3.44304744e-02 0.00000000e+00 0.00000000e+00
9.73313804e-03 -0.00000000e+00]
feats_df = find_order_features(get_coefs(l2))
feats_df.sort_values('abs_coefficients', ascending = False)
# Add something about step-wise linear regression as linear regression rmse is sligthly lower than the one for lasso.
# Run the following to render to PDF
!jupyter nbconvert --to pdf project1.ipynb
[NbConvertApp] Converting notebook project1.ipynb to pdf
[NbConvertApp] ERROR | Error while converting 'project1.ipynb'
Traceback (most recent call last):
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 418, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 181, in from_filename
return self.from_file(f, resources=resources, **kw)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 199, in from_file
return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/exporters/pdf.py", line 169, in from_notebook_node
nb, resources=resources, **kw
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/exporters/latex.py", line 77, in from_notebook_node
return super().from_notebook_node(nb, resources, **kw)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/exporters/templateexporter.py", line 384, in from_notebook_node
output = self.template.render(nb=nb_copy, resources=resources)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/index.tex.j2", line 8, in top-level template code
((* extends cell_style *))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/style_jupyter.tex.j2", line 176, in top-level template code
\prompt{(((prompt)))}{(((prompt_color)))}{(((execution_count)))}{(((extra_space)))}
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 7, in top-level template code
((*- extends 'document_contents.tex.j2' -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2", line 51, in top-level template code
((*- block figure scoped -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/display_priority.j2", line 5, in top-level template code
((*- extends 'null.j2' -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/null.j2", line 30, in top-level template code
((*- block body -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 206, in block "body"
((( super() )))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/null.j2", line 32, in block "body"
((*- block any_cell scoped -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/null.j2", line 85, in block "any_cell"
((*- block markdowncell scoped-*)) ((*- endblock markdowncell -*))
File "/shared-libs/python3.7/py-core/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2", line 68, in block "markdowncell"
((( cell.source | citation2latex | strip_files_prefix | convert_pandoc('markdown+tex_math_double_backslash', 'json',extra_args=[]) | resolve_references | convert_pandoc('json','latex'))))
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/filters/pandoc.py", line 24, in convert_pandoc
return pandoc(source, from_format, to_format, extra_args=extra_args)
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/utils/pandoc.py", line 52, in pandoc
check_pandoc_version()
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/utils/pandoc.py", line 100, in check_pandoc_version
v = get_pandoc_version()
File "/shared-libs/python3.7/py-core/lib/python3.7/site-packages/nbconvert/utils/pandoc.py", line 77, in get_pandoc_version
raise PandocMissing()
nbconvert.utils.pandoc.PandocMissing: Pandoc wasn't found.
Please check that pandoc is installed:
https://pandoc.org/installing.html