1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Excel to Python\n",
"\n",
"- Importing\n",
"- Plotting\n",
"- Statistical analysis\n",
"\n",
"## **How Excel Translates to Python**\n",
"\n",
"Here’s how common Excel functionalities map to Python:\n",
"\n",
"| **Excel Feature** | **Python Equivalent** |\n",
"|----------------------|--------------------------------------------------|\n",
"| Formulas (SUM, AVERAGE) | `numpy`, `pandas` (`df.sum()`, `df.mean()`) |\n",
"| Sorting & Filtering | `pandas.sort_values()`, `df[df['col'] > value]` |\n",
"| Conditional Formatting | `matplotlib` for highlighting |\n",
"| Pivot Tables | `pandas.pivot_table()` |\n",
"| Charts & Graphs | `matplotlib`, `seaborn`, `plotly` |\n",
"| Regression Analysis | `scipy.stats.linregress`, `sklearn.linear_model` |\n",
"| Solver/Optimization | `scipy.optimize` |\n",
"| VBA Macros | Python scripting with `openpyxl`, `pandas`, or `xlwings` |\n",
"\n",
"## Statistical functions\n",
"\n",
"#### SUM\n",
"\n",
"Built-in:\n",
"\n",
"``` python\n",
"my_array = [1, 2, 3, 4, 5]\n",
"total = sum(my_array)\n",
"print(total) # Output: 15\n",
"```\n",
"\n",
"Numpy:\n",
"\n",
"``` python\n",
"import numpy as np\n",
"\n",
"my_array = np.array([1, 2, 3, 4, 5])\n",
"total = np.sum(my_array)\n",
"print(total) # Output: 15\n",
"```\n",
"\n",
"### Average\n",
"\n",
"Built-in:\n",
"\n",
"``` python\n",
"my_array = [1, 2, 3, 4, 5]\n",
"average = sum(my_array) / len(my_array)\n",
"print(average) # Output: 3.0\n",
"```\n",
"\n",
"Numpy:\n",
"\n",
"``` python\n",
"import numpy as np\n",
"\n",
"my_array = np.array([1, 2, 3, 4, 5])\n",
"average = np.mean(my_array)\n",
"print(average) # Output: 3.0\n",
"```\n",
"\n",
"## Plotting\n",
"\n",
"We can use the package *matplotlib* to plot our graphs in python.\n",
"Matplotlib provides data visualization tools for the Scientific Python\n",
"Ecosystem. You can make very professional looking figures with this\n",
"tool.\n",
"\n",
"Here is a section from the matplotlib documentation page that you can\n",
"run in python.\n",
"\n",
"``` python\n",
"import matplotlib.pyplot as plt\n",
"\n",
"fig, ax = plt.subplots() # Create a figure containing a single Axes.\n",
"ax.plot([1, 2, 3, 4], [1, 4, 2, 3]) # Plot some data on the Axes.\n",
"plt.show() # Show the figure.\n",
"```\n",
"\n",
"Check out the documentation pages for a [simple\n",
"example](https://matplotlib.org/stable/users/explain/quick_start.html#a-simple-example)\n",
"or more information on the types of plots you came create\n",
"[here](https://matplotlib.org/stable/plot_types/index.html)."
],
"id": "3e04cd8a-c731-494a-bf4f-dfe745a8a487"
}
],
"nbformat": 4,
"nbformat_minor": 5,
"metadata": {}
}
|