Jun 5, 2024
=PY
, press Tab to switch to Python mode.XL
function in the formula bar.Ctrl + Enter
to run the Python script and obtain a DataFrame.df.describe()
to get summary statistics like count, mean, and standard deviation.df['Product']
or df.Product
)..sum()
method (e.g., df.sales.sum()
for total sales)..mean()
method.df.groupby('date').sales.sum()
produces total sales for each date.pd.Grouper(key='date', freq='M')
within groupby to aggregate by month.plot
method to visualize data in cells (e.g., forchart.plot(kind='line')
).pd.melt
to restructure data columns (e.g., merging Quantity and Sales columns into a single column).query
method to filter data (e.g., df.query('sales > 2000 and Product.str.contains("black")')
).re
for regular expressions.