Bonjour,
Input In [82]
from r-ltxsparklines import sparklines
^
SyntaxError: invalid syntax
After other modifications, error is:
NameError: name 'sparklines' is not defined
The question is: how to define 'sparklines' or which libraries to import so that the 'sparklines' function is recognized?
Regards,
Leloup
import data # Loading a Sample Pandas DataFrame import pandas as pd import numpy as np import seaborn as sns df = sns.load_dataset('titanic')code is:
def percentile_90(x): return x.quantile(.9) from scipy.stats import trim_mean def trim_mean_10(x): return trim_mean(x, 0.1) def largest(x): return x.nlargest(1) import matplotlib.pyplot as plt import base64 from r-ltxsparklines import sparklines def sparkline_str(x): bins=np.histogram(x)[0] sl = ''.join(sparklines(bins)) return sl #Les voici tous rassemblés : agg_func_largest = { 'fare': [percentile_90, trim_mean_10, largest, sparkline_str] } df.groupby(['class', 'embark_town']).agg(agg_func_largest)that produces:
Input In [82]
from r-ltxsparklines import sparklines
^
SyntaxError: invalid syntax
After other modifications, error is:
NameError: name 'sparklines' is not defined
The question is: how to define 'sparklines' or which libraries to import so that the 'sparklines' function is recognized?
Regards,
Leloup
Larz60+ write Apr-19-2022, 07:19 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBCode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBCode tags on future posts.