diff --git a/.gitignore b/.gitignore index b6e4761..1d4e738 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,5 @@ dmypy.json # Pyre type checker .pyre/ + +.idea/ \ No newline at end of file diff --git a/.idea/awesome-python-framework.iml b/.idea/awesome-python-framework.iml index 8dc09e5..a146527 100644 --- a/.idea/awesome-python-framework.iml +++ b/.idea/awesome-python-framework.iml @@ -2,7 +2,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 6649a8c..6a81379 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2dea54b..a2e1cff 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,67 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -127,7 +132,8 @@ - + + 1665820989225 @@ -178,7 +184,56 @@ - @@ -189,15 +244,14 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + \ No newline at end of file diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/001-data-index.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/001-data-index.xlsx" new file mode 100644 index 0000000..875c5cf Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/001-data-index.xlsx" differ diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/001-data.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/001-data.xlsx" new file mode 100644 index 0000000..e52c4e8 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/001-data.xlsx" differ diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/001.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/001.xlsx" new file mode 100644 index 0000000..f40be19 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/001.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/001/1.1-\264\264\275\250Excel\316\304\274\376\243\250\316\336\312\375\276\335\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/1.1-\345\210\233\345\273\272Excel\346\226\207\344\273\266\357\274\210\346\227\240\346\225\260\346\215\256\357\274\211.py" similarity index 73% rename from "course/PandasVersusExcel-Code/001/1.1-\264\264\275\250Excel\316\304\274\376\243\250\316\336\312\375\276\335\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/1.1-\345\210\233\345\273\272Excel\346\226\207\344\273\266\357\274\210\346\227\240\346\225\260\346\215\256\357\274\211.py" index 2f47eb6..064e9c9 100644 --- "a/course/PandasVersusExcel-Code/001/1.1-\264\264\275\250Excel\316\304\274\376\243\250\316\336\312\375\276\335\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/1.1-\345\210\233\345\273\272Excel\346\226\207\344\273\266\357\274\210\346\227\240\346\225\260\346\215\256\357\274\211.py" @@ -1,11 +1,11 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH - -import pandas as pd - -df = pd.DataFrame() -# 创建DataFrame对象 -df.to_excel("./001.xlsx") +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH + +import pandas as pd + +df = pd.DataFrame() +# 创建DataFrame对象 +df.to_excel("./001.xlsx") print("Done!") \ No newline at end of file diff --git "a/course/PandasVersusExcel-Code/001/1.2-\264\264\275\250Excel\316\304\274\376\243\250\323\320\312\375\276\335\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/1.2-\345\210\233\345\273\272Excel\346\226\207\344\273\266\357\274\210\346\234\211\346\225\260\346\215\256\357\274\211.py" similarity index 77% rename from "course/PandasVersusExcel-Code/001/1.2-\264\264\275\250Excel\316\304\274\376\243\250\323\320\312\375\276\335\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/1.2-\345\210\233\345\273\272Excel\346\226\207\344\273\266\357\274\210\346\234\211\346\225\260\346\215\256\357\274\211.py" index 201b301..c22c8b7 100644 --- "a/course/PandasVersusExcel-Code/001/1.2-\264\264\275\250Excel\316\304\274\376\243\250\323\320\312\375\276\335\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/1.2-\345\210\233\345\273\272Excel\346\226\207\344\273\266\357\274\210\346\234\211\346\225\260\346\215\256\357\274\211.py" @@ -1,10 +1,10 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -df = pd.DataFrame({"ID": [1, 2, 3], "Name": ["Tim", "Victory", "Nick"]}) -# 创建DataFrame对象 -df.to_excel("./001-data.xlsx") -print("Done!") +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +df = pd.DataFrame({"ID": [1, 2, 3], "Name": ["Tim", "Victory", "Nick"]}) +# 创建DataFrame对象 +df.to_excel("./001-data.xlsx") +print("Done!") diff --git "a/course/PandasVersusExcel-Code/001/1.3-\264\264\275\250Excel\316\304\274\376\243\250\323\320\312\375\276\335\243\254\275\253ID\327\367\316\252\313\367\322\375\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/1.3-\345\210\233\345\273\272Excel\346\226\207\344\273\266\357\274\210\346\234\211\346\225\260\346\215\256\357\274\214\345\260\206ID\344\275\234\344\270\272\347\264\242\345\274\225\357\274\211.py" similarity index 79% rename from "course/PandasVersusExcel-Code/001/1.3-\264\264\275\250Excel\316\304\274\376\243\250\323\320\312\375\276\335\243\254\275\253ID\327\367\316\252\313\367\322\375\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/1.3-\345\210\233\345\273\272Excel\346\226\207\344\273\266\357\274\210\346\234\211\346\225\260\346\215\256\357\274\214\345\260\206ID\344\275\234\344\270\272\347\264\242\345\274\225\357\274\211.py" index 832c87e..bcc3525 100644 --- "a/course/PandasVersusExcel-Code/001/1.3-\264\264\275\250Excel\316\304\274\376\243\250\323\320\312\375\276\335\243\254\275\253ID\327\367\316\252\313\367\322\375\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/001/1.3-\345\210\233\345\273\272Excel\346\226\207\344\273\266\357\274\210\346\234\211\346\225\260\346\215\256\357\274\214\345\260\206ID\344\275\234\344\270\272\347\264\242\345\274\225\357\274\211.py" @@ -1,13 +1,13 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -df = pd.DataFrame({"ID": [1, 2, 3], "Name": ["Tim", "Victory", "Nick"]}) -# 创建DataFrame对象 -df=df.set_index("ID") -# 设置索引 -print(df) -df.to_excel("./001-data-index.xlsx") -print("Done!") +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +df = pd.DataFrame({"ID": [1, 2, 3], "Name": ["Tim", "Victory", "Nick"]}) +# 创建DataFrame对象 +df=df.set_index("ID") +# 设置索引 +print(df) +df.to_excel("./001-data-index.xlsx") +print("Done!") diff --git "a/course/PandasVersusExcel-Code/002/2.1-\266\301\310\241Excel\316\304\274\376.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.1-\350\257\273\345\217\226Excel\346\226\207\344\273\266.py" similarity index 77% rename from "course/PandasVersusExcel-Code/002/2.1-\266\301\310\241Excel\316\304\274\376.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.1-\350\257\273\345\217\226Excel\346\226\207\344\273\266.py" index 5444c0d..60ffe02 100644 --- "a/course/PandasVersusExcel-Code/002/2.1-\266\301\310\241Excel\316\304\274\376.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.1-\350\257\273\345\217\226Excel\346\226\207\344\273\266.py" @@ -1,12 +1,12 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -people = pd.read_excel("./Books.xlsx") -print(people.shape) -print(people.columns) -print(people.head(1)) -print("================") +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +people = pd.read_excel("./Books.xlsx") +print(people.shape) +print(people.columns) +print(people.head(1)) +print("================") print(people.tail(1)) \ No newline at end of file diff --git "a/course/PandasVersusExcel-Code/002/2.2-\266\301\310\241Excel\316\304\274\376\243\250\264\355\316\273\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.2-\350\257\273\345\217\226Excel\346\226\207\344\273\266\357\274\210\351\224\231\344\275\215\357\274\211.py" similarity index 74% rename from "course/PandasVersusExcel-Code/002/2.2-\266\301\310\241Excel\316\304\274\376\243\250\264\355\316\273\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.2-\350\257\273\345\217\226Excel\346\226\207\344\273\266\357\274\210\351\224\231\344\275\215\357\274\211.py" index 64a33b7..715fb4f 100644 --- "a/course/PandasVersusExcel-Code/002/2.2-\266\301\310\241Excel\316\304\274\376\243\250\264\355\316\273\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.2-\350\257\273\345\217\226Excel\346\226\207\344\273\266\357\274\210\351\224\231\344\275\215\357\274\211.py" @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -people = pd.read_excel("./example-malposition.xlsx", header=1) -print(people.columns) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +people = pd.read_excel("./example-malposition.xlsx", header=1) +print(people.columns) diff --git "a/course/PandasVersusExcel-Code/002/2.3-\266\301\310\241Excel\316\304\274\376\243\250\323\320\277\325\320\320\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.3-\350\257\273\345\217\226Excel\346\226\207\344\273\266\357\274\210\346\234\211\347\251\272\350\241\214\357\274\211.py" similarity index 76% rename from "course/PandasVersusExcel-Code/002/2.3-\266\301\310\241Excel\316\304\274\376\243\250\323\320\277\325\320\320\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.3-\350\257\273\345\217\226Excel\346\226\207\344\273\266\357\274\210\346\234\211\347\251\272\350\241\214\357\274\211.py" index 9adec16..788ebda 100644 --- "a/course/PandasVersusExcel-Code/002/2.3-\266\301\310\241Excel\316\304\274\376\243\250\323\320\277\325\320\320\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.3-\350\257\273\345\217\226Excel\346\226\207\344\273\266\357\274\210\346\234\211\347\251\272\350\241\214\357\274\211.py" @@ -1,9 +1,9 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -people = pd.read_excel("./example-empty_row.xlsx", header=1) -# pandas版本1.3.5,无法跳过空行。 -print(people.columns) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +people = pd.read_excel("./example-empty_row.xlsx", header=1) +# pandas版本1.3.5,无法跳过空行。 +print(people.columns) diff --git "a/course/PandasVersusExcel-Code/002/2.4-\266\301\310\241Excel\316\304\274\376\243\250\316\336\261\352\314\342\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.4-\350\257\273\345\217\226Excel\346\226\207\344\273\266\357\274\210\346\227\240\346\240\207\351\242\230\357\274\211.py" similarity index 79% rename from "course/PandasVersusExcel-Code/002/2.4-\266\301\310\241Excel\316\304\274\376\243\250\316\336\261\352\314\342\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.4-\350\257\273\345\217\226Excel\346\226\207\344\273\266\357\274\210\346\227\240\346\240\207\351\242\230\357\274\211.py" index 0087558..6d02518 100644 --- "a/course/PandasVersusExcel-Code/002/2.4-\266\301\310\241Excel\316\304\274\376\243\250\316\336\261\352\314\342\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.4-\350\257\273\345\217\226Excel\346\226\207\344\273\266\357\274\210\346\227\240\346\240\207\351\242\230\357\274\211.py" @@ -1,12 +1,12 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -people = pd.read_excel("./example-no_header.xlsx", header=None) -people.columns = ["ID", "Name"] -people.set_index("ID", inplace=True) -print(people.columns) -people.to_excel("./example-add_header.xlsx") -print("Done!") +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +people = pd.read_excel("./example-no_header.xlsx", header=None) +people.columns = ["ID", "Name"] +people.set_index("ID", inplace=True) +print(people.columns) +people.to_excel("./example-add_header.xlsx") +print("Done!") diff --git "a/course/PandasVersusExcel-Code/002/2.5-\275\342\276\366\266\301\310\241\273\341\311\372\263\311\320\302\265\304index\316\312\314\342.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.5-\350\247\243\345\206\263\350\257\273\345\217\226\344\274\232\347\224\237\346\210\220\346\226\260\347\232\204index\351\227\256\351\242\230.py" similarity index 77% rename from "course/PandasVersusExcel-Code/002/2.5-\275\342\276\366\266\301\310\241\273\341\311\372\263\311\320\302\265\304index\316\312\314\342.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.5-\350\247\243\345\206\263\350\257\273\345\217\226\344\274\232\347\224\237\346\210\220\346\226\260\347\232\204index\351\227\256\351\242\230.py" index 1041a67..48909a7 100644 --- "a/course/PandasVersusExcel-Code/002/2.5-\275\342\276\366\266\301\310\241\273\341\311\372\263\311\320\302\265\304index\316\312\314\342.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/2.5-\350\247\243\345\206\263\350\257\273\345\217\226\344\274\232\347\224\237\346\210\220\346\226\260\347\232\204index\351\227\256\351\242\230.py" @@ -1,10 +1,10 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -df = pd.read_excel("./Books.xlsx") -df.to_excel("./example-1.xlsx") -df = pd.read_excel("./Books.xlsx", index_col="ID") -df.to_excel("./example-2.xlsx") +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +df = pd.read_excel("./Books.xlsx") +df.to_excel("./example-1.xlsx") +df = pd.read_excel("./Books.xlsx", index_col="ID") +df.to_excel("./example-2.xlsx") diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-1.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-1.xlsx" new file mode 100644 index 0000000..bf60c10 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-1.xlsx" differ diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-2.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-2.xlsx" new file mode 100644 index 0000000..8079ade Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-2.xlsx" differ diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-add_header.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-add_header.xlsx" new file mode 100644 index 0000000..ba280ce Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-add_header.xlsx" differ diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-empty_row.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-empty_row.xlsx" new file mode 100644 index 0000000..7a8cd34 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-empty_row.xlsx" differ diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-malposition.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-malposition.xlsx" new file mode 100644 index 0000000..6ed7574 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-malposition.xlsx" differ diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-no_header.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-no_header.xlsx" new file mode 100644 index 0000000..dafec58 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example-no_header.xlsx" differ diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example.xlsx" new file mode 100644 index 0000000..875c5cf Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/002/example.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/003/3.1-pd.Series\272\315\327\326\265\344.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/003/3.1-pd.Series\345\222\214\345\255\227\345\205\270.py" similarity index 78% rename from "course/PandasVersusExcel-Code/003/3.1-pd.Series\272\315\327\326\265\344.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/003/3.1-pd.Series\345\222\214\345\255\227\345\205\270.py" index 95f8628..12efd19 100644 --- "a/course/PandasVersusExcel-Code/003/3.1-pd.Series\272\315\327\326\265\344.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/003/3.1-pd.Series\345\222\214\345\255\227\345\205\270.py" @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ # 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH import pandas as pd diff --git "a/course/PandasVersusExcel-Code/003/3.2-\311\372\263\311pd,Series.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/003/3.2-\347\224\237\346\210\220pd,Series.py" similarity index 73% rename from "course/PandasVersusExcel-Code/003/3.2-\311\372\263\311pd,Series.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/003/3.2-\347\224\237\346\210\220pd,Series.py" index 3ffcf50..deed34a 100644 --- "a/course/PandasVersusExcel-Code/003/3.2-\311\372\263\311pd,Series.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/003/3.2-\347\224\237\346\210\220pd,Series.py" @@ -1,10 +1,10 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -L1 = [100, 200, 300] -L2 = ["x", "y", "z"] -s1 = pd.Series(L1, index=L2) -print(s1) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +L1 = [100, 200, 300] +L2 = ["x", "y", "z"] +s1 = pd.Series(L1, index=L2) +print(s1) diff --git "a/course/PandasVersusExcel-Code/003/3.3-\275\253Series\314\355\274\323\265\275DataFrame.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/003/3.3-\345\260\206Series\346\267\273\345\212\240\345\210\260DataFrame.py" similarity index 83% rename from "course/PandasVersusExcel-Code/003/3.3-\275\253Series\314\355\274\323\265\275DataFrame.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/003/3.3-\345\260\206Series\346\267\273\345\212\240\345\210\260DataFrame.py" index 1b85950..942f316 100644 --- "a/course/PandasVersusExcel-Code/003/3.3-\275\253Series\314\355\274\323\265\275DataFrame.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/003/3.3-\345\260\206Series\346\267\273\345\212\240\345\210\260DataFrame.py" @@ -1,15 +1,15 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -s1 = pd.Series([1, 2, 3], index=[1, 2, 3], name="A") -s2 = pd.Series([10, 20, 30], index=[1, 2, 3], name="B") -s3 = pd.Series([100, 200, 300], index=[2, 3, 4], name="C") -df = pd.DataFrame([s1, s2, s3]) -# 以列表形式添加 -print(df) -df = pd.DataFrame({s1.name: s1, s2.name: s2, s3.name: s3}) -# 以字典形式添加 -print(df) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +s1 = pd.Series([1, 2, 3], index=[1, 2, 3], name="A") +s2 = pd.Series([10, 20, 30], index=[1, 2, 3], name="B") +s3 = pd.Series([100, 200, 300], index=[2, 3, 4], name="C") +df = pd.DataFrame([s1, s2, s3]) +# 以列表形式添加 +print(df) +df = pd.DataFrame({s1.name: s1, s2.name: s2, s3.name: s3}) +# 以字典形式添加 +print(df) diff --git "a/course/PandasVersusExcel-Code/004\241\242005/Books.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/004\343\200\201005/Books.xlsx" similarity index 100% rename from "course/PandasVersusExcel-Code/004\241\242005/Books.xlsx" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/004\343\200\201005/Books.xlsx" diff --git "a/course/PandasVersusExcel-Code/004\241\242005/Output.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/004\343\200\201005/Output.xlsx" similarity index 100% rename from "course/PandasVersusExcel-Code/004\241\242005/Output.xlsx" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/004\343\200\201005/Output.xlsx" diff --git "a/course/PandasVersusExcel-Code/004\241\242005/\327\324\266\257\314\356\263\344.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/004\343\200\201005/\350\207\252\345\212\250\345\241\253\345\205\205.py" similarity index 89% rename from "course/PandasVersusExcel-Code/004\241\242005/\327\324\266\257\314\356\263\344.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/004\343\200\201005/\350\207\252\345\212\250\345\241\253\345\205\205.py" index 98644fd..87f575e 100644 --- "a/course/PandasVersusExcel-Code/004\241\242005/\327\324\266\257\314\356\263\344.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/004\343\200\201005/\350\207\252\345\212\250\345\241\253\345\205\205.py" @@ -1,31 +1,31 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -from datetime import date, timedelta - - -def add_month(d, md): - yd = md // 12 - m = d.month + md % 12 - if m != 12: - yd += m // 12 - m = m % 12 - return date(d.year + yd, m, d.day) - - -books = pd.read_excel("./Books.xlsx", skiprows=3, usecols="C:F", index_col=None, - dtype={"ID": str, "InStore": str, "Date": str}) -start = date(2018, 1, 1) -for i in books.index: - books["ID"].at[i] = i + 1 # 拿到Series改 - # books.at[i, "ID"] = i + 1 # 直接改DataFrame - books["InStore"].at[i] = "Yes" if i % 2 == 0 else "No" - # books["Date"].at[i] = start + timedelta(days=i) # 加一天 - # books["Date"].at[i] = date(start.year + i, start.month, start.day) # 加一年 - books["Date"].at[i] = add_month(start, i) # 加一月 -books.set_index("ID", inplace=True) -print(books) -books.to_excel("./Output.xlsx") -print("Done!") +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +from datetime import date, timedelta + + +def add_month(d, md): + yd = md // 12 + m = d.month + md % 12 + if m != 12: + yd += m // 12 + m = m % 12 + return date(d.year + yd, m, d.day) + + +books = pd.read_excel("./Books.xlsx", skiprows=3, usecols="C:F", index_col=None, + dtype={"ID": str, "InStore": str, "Date": str}) +start = date(2018, 1, 1) +for i in books.index: + books["ID"].at[i] = i + 1 # 拿到Series改 + # books.at[i, "ID"] = i + 1 # 直接改DataFrame + books["InStore"].at[i] = "Yes" if i % 2 == 0 else "No" + # books["Date"].at[i] = start + timedelta(days=i) # 加一天 + # books["Date"].at[i] = date(start.year + i, start.month, start.day) # 加一年 + books["Date"].at[i] = add_month(start, i) # 加一月 +books.set_index("ID", inplace=True) +print(books) +books.to_excel("./Output.xlsx") +print("Done!") diff --git "a/course/PandasVersusExcel-Code/006/6.1-\274\306\313\343\301\320.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/006/6.1-\350\256\241\347\256\227\345\210\227.py" similarity index 81% rename from "course/PandasVersusExcel-Code/006/6.1-\274\306\313\343\301\320.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/006/6.1-\350\256\241\347\256\227\345\210\227.py" index bcafd5f..d775e2e 100644 --- "a/course/PandasVersusExcel-Code/006/6.1-\274\306\313\343\301\320.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/006/6.1-\350\256\241\347\256\227\345\210\227.py" @@ -1,11 +1,11 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -books = pd.read_excel("./example.xlsx", index_col="ID") -# books["Price"] = books["ListPrice"] * books["Discount"] # 直接计算 -for i in books.index: # 用循环计算 - books["Price"].at[i] = books["ListPrice"].at[i] * books["Discount"].at[i] -print(books) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +books = pd.read_excel("./example.xlsx", index_col="ID") +# books["Price"] = books["ListPrice"] * books["Discount"] # 直接计算 +for i in books.index: # 用循环计算 + books["Price"].at[i] = books["ListPrice"].at[i] * books["Discount"].at[i] +print(books) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/006/6.2-pd.Series.apply.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/006/6.2-pd.Series.apply.py" new file mode 100644 index 0000000..d3b5e68 --- /dev/null +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/006/6.2-pd.Series.apply.py" @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + + +def add_2(x): + return x + 2 + + +books = pd.read_excel("./example.xlsx", index_col="ID") +books["ListPrice"] = books["ListPrice"].apply(add_2) +print(books) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/006/example.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/006/example.xlsx" new file mode 100644 index 0000000..fd83576 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/006/example.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/007/7.1-\266\340\326\330\305\305\320\362.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/007/7.1-\345\244\232\351\207\215\346\216\222\345\272\217.py" similarity index 78% rename from "course/PandasVersusExcel-Code/007/7.1-\266\340\326\330\305\305\320\362.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/007/7.1-\345\244\232\351\207\215\346\216\222\345\272\217.py" index b0d9499..1b53553 100644 --- "a/course/PandasVersusExcel-Code/007/7.1-\266\340\326\330\305\305\320\362.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/007/7.1-\345\244\232\351\207\215\346\216\222\345\272\217.py" @@ -1,9 +1,9 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -products = pd.read_excel("./example.xlsx", index_col="ID") -products.sort_values(by=["Worthy", "Price"], inplace=True, ascending=[True, False]) -print(products) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +products = pd.read_excel("./example.xlsx", index_col="ID") +products.sort_values(by=["Worthy", "Price"], inplace=True, ascending=[True, False]) +print(products) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/007/example.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/007/example.xlsx" new file mode 100644 index 0000000..16886f6 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/007/example.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/008/8.1-\312\375\276\335\311\270\321\241\323\353\271\375\302\313.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/008/8.1-\346\225\260\346\215\256\347\255\233\351\200\211\344\270\216\350\277\207\346\273\244.py" similarity index 81% rename from "course/PandasVersusExcel-Code/008/8.1-\312\375\276\335\311\270\321\241\323\353\271\375\302\313.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/008/8.1-\346\225\260\346\215\256\347\255\233\351\200\211\344\270\216\350\277\207\346\273\244.py" index f41899b..6c49de2 100644 --- "a/course/PandasVersusExcel-Code/008/8.1-\312\375\276\335\311\270\321\241\323\353\271\375\302\313.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/008/8.1-\346\225\260\346\215\256\347\255\233\351\200\211\344\270\216\350\277\207\346\273\244.py" @@ -1,18 +1,18 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - - -def age_18_to_30(a): - return a >= 18 and a <= 30 - - -def level_a(s): - return 85 <= s <= 100 - - -students = pd.read_excel("./example.xlsx", index_col="ID") -students = students.loc[students["Age"].apply(age_18_to_30)].loc[students.Score.apply(level_a)] -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + + +def age_18_to_30(a): + return a >= 18 and a <= 30 + + +def level_a(s): + return 85 <= s <= 100 + + +students = pd.read_excel("./example.xlsx", index_col="ID") +students = students.loc[students["Age"].apply(age_18_to_30)].loc[students.Score.apply(level_a)] +print(students) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/008/example.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/008/example.xlsx" new file mode 100644 index 0000000..b7f139b Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/008/example.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/009/9.1-\326\371\327\264\315\274\243\250pandas\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/009/9.1-\346\237\261\347\212\266\345\233\276\357\274\210pandas\357\274\211.py" similarity index 82% rename from "course/PandasVersusExcel-Code/009/9.1-\326\371\327\264\315\274\243\250pandas\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/009/9.1-\346\237\261\347\212\266\345\233\276\357\274\210pandas\357\274\211.py" index 17e089b..892b21a 100644 --- "a/course/PandasVersusExcel-Code/009/9.1-\326\371\327\264\315\274\243\250pandas\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/009/9.1-\346\237\261\347\212\266\345\233\276\357\274\210pandas\357\274\211.py" @@ -1,13 +1,13 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt - -students = pd.read_excel("./example.xlsx") -students.sort_values(by="Number", inplace=True, ascending=False) -print(students) -students.plot.bar(x="Field", y="Number", color="orange", title="International Students by Field") -plt.tight_layout() -plt.show() +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt + +students = pd.read_excel("./example.xlsx") +students.sort_values(by="Number", inplace=True, ascending=False) +print(students) +students.plot.bar(x="Field", y="Number", color="orange", title="International Students by Field") +plt.tight_layout() +plt.show() diff --git "a/course/PandasVersusExcel-Code/009/9.2-\326\371\327\264\315\274\243\250matplotlib\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/009/9.2-\346\237\261\347\212\266\345\233\276\357\274\210matplotlib\357\274\211.py" similarity index 84% rename from "course/PandasVersusExcel-Code/009/9.2-\326\371\327\264\315\274\243\250matplotlib\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/009/9.2-\346\237\261\347\212\266\345\233\276\357\274\210matplotlib\357\274\211.py" index 3e78e4c..01b7802 100644 --- "a/course/PandasVersusExcel-Code/009/9.2-\326\371\327\264\315\274\243\250matplotlib\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/009/9.2-\346\237\261\347\212\266\345\233\276\357\274\210matplotlib\357\274\211.py" @@ -1,17 +1,17 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt - -students = pd.read_excel("./example.xlsx") -students.sort_values(by="Number", inplace=True, ascending=False) -print(students) -plt.bar(students.Field, students.Number, color="orange") -plt.xticks(students.Field, rotation="90") -plt.xlabel("Field") -plt.ylabel("Number") -plt.title("International Students by Field", fontsize=16) -plt.tight_layout() -plt.show() +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt + +students = pd.read_excel("./example.xlsx") +students.sort_values(by="Number", inplace=True, ascending=False) +print(students) +plt.bar(students.Field, students.Number, color="orange") +plt.xticks(students.Field, rotation="90") +plt.xlabel("Field") +plt.ylabel("Number") +plt.title("International Students by Field", fontsize=16) +plt.tight_layout() +plt.show() diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/009/example.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/009/example.xlsx" new file mode 100644 index 0000000..1cd2a19 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/009/example.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/010/10.1-\267\326\327\351\326\371\327\264\315\274.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/010/10.1-\345\210\206\347\273\204\346\237\261\347\212\266\345\233\276.py" similarity index 86% rename from "course/PandasVersusExcel-Code/010/10.1-\267\326\327\351\326\371\327\264\315\274.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/010/10.1-\345\210\206\347\273\204\346\237\261\347\212\266\345\233\276.py" index 30c5b11..8401216 100644 --- "a/course/PandasVersusExcel-Code/010/10.1-\267\326\327\351\326\371\327\264\315\274.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/010/10.1-\345\210\206\347\273\204\346\237\261\347\212\266\345\233\276.py" @@ -1,20 +1,20 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt - -students = pd.read_excel("./example.xlsx") -students.sort_values(by="2017", inplace=True, ascending=False) -print(students) -students.plot.bar(x="Field", y=["2016", "2017"], color=["orange", "red"]) -plt.title("International Students by Field", fontsize=16, fontweight="bold") -plt.xlabel("Field", fontweight="bold") -plt.ylabel("Number", fontweight="bold") -ax = plt.gca() -ax.set_xticklabels(students["Field"], rotation=45, ha="right") -f = plt.gcf() -f.subplots_adjust(left=0.2, bottom=0.42) -plt.tight_layout() -plt.show() +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt + +students = pd.read_excel("./example.xlsx") +students.sort_values(by="2017", inplace=True, ascending=False) +print(students) +students.plot.bar(x="Field", y=["2016", "2017"], color=["orange", "red"]) +plt.title("International Students by Field", fontsize=16, fontweight="bold") +plt.xlabel("Field", fontweight="bold") +plt.ylabel("Number", fontweight="bold") +ax = plt.gca() +ax.set_xticklabels(students["Field"], rotation=45, ha="right") +f = plt.gcf() +f.subplots_adjust(left=0.2, bottom=0.42) +plt.tight_layout() +plt.show() diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/010/example.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/010/example.xlsx" new file mode 100644 index 0000000..490417d Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/010/example.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/011/11.1-\265\376\274\323\326\371\327\264\315\274.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/011/11.1-\345\217\240\345\212\240\346\237\261\347\212\266\345\233\276.py" similarity index 82% rename from "course/PandasVersusExcel-Code/011/11.1-\265\376\274\323\326\371\327\264\315\274.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/011/11.1-\345\217\240\345\212\240\346\237\261\347\212\266\345\233\276.py" index 58cd51d..faea50f 100644 --- "a/course/PandasVersusExcel-Code/011/11.1-\265\376\274\323\326\371\327\264\315\274.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/011/11.1-\345\217\240\345\212\240\346\237\261\347\212\266\345\233\276.py" @@ -1,14 +1,14 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt - -users = pd.read_excel("./example.xlsx") -users["Total"] = users["Oct"] + users["Nov"] + users["Dec"] -users.sort_values(by="Total", inplace=True) -print(users) -users.plot.barh(x="Name", y=["Oct", "Nov", "Dec"], stacked=True, title="User Behavior") -plt.tight_layout() -plt.show() +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt + +users = pd.read_excel("./example.xlsx") +users["Total"] = users["Oct"] + users["Nov"] + users["Dec"] +users.sort_values(by="Total", inplace=True) +print(users) +users.plot.barh(x="Name", y=["Oct", "Nov", "Dec"], stacked=True, title="User Behavior") +plt.tight_layout() +plt.show() diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/011/example.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/011/example.xlsx" new file mode 100644 index 0000000..8af26c5 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/011/example.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/012/12.1-\261\375\315\274.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/012/12.1-\351\245\274\345\233\276.py" similarity index 85% rename from "course/PandasVersusExcel-Code/012/12.1-\261\375\315\274.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/012/12.1-\351\245\274\345\233\276.py" index 0050019..491e249 100644 --- "a/course/PandasVersusExcel-Code/012/12.1-\261\375\315\274.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/012/12.1-\351\245\274\345\233\276.py" @@ -1,14 +1,14 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt - -students = pd.read_excel("./example.xlsx", index_col="From") -print(students) -# students["2017"].sort_values(ascending=True).plot.pie(fontsize=8,startangle=-270) -students["2017"].plot.pie(fontsize=8, counterclock=False, startangle=-270) -plt.title("Source of International Students", fontsize=16, fontweight="bold") -plt.ylabel("2017", fontsize=12, fontweight="bold") -plt.show() +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt + +students = pd.read_excel("./example.xlsx", index_col="From") +print(students) +# students["2017"].sort_values(ascending=True).plot.pie(fontsize=8,startangle=-270) +students["2017"].plot.pie(fontsize=8, counterclock=False, startangle=-270) +plt.title("Source of International Students", fontsize=16, fontweight="bold") +plt.ylabel("2017", fontsize=12, fontweight="bold") +plt.show() diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/012/example.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/012/example.xlsx" new file mode 100644 index 0000000..4702a02 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/012/example.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/013/13.1-\325\333\317\337\315\274\272\315\265\376\274\323\307\370\323\362\315\274.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/013/13.1-\346\212\230\347\272\277\345\233\276\345\222\214\345\217\240\345\212\240\345\214\272\345\237\237\345\233\276.py" similarity index 86% rename from "course/PandasVersusExcel-Code/013/13.1-\325\333\317\337\315\274\272\315\265\376\274\323\307\370\323\362\315\274.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/013/13.1-\346\212\230\347\272\277\345\233\276\345\222\214\345\217\240\345\212\240\345\214\272\345\237\237\345\233\276.py" index 5192c04..d41aabe 100644 --- "a/course/PandasVersusExcel-Code/013/13.1-\325\333\317\337\315\274\272\315\265\376\274\323\307\370\323\362\315\274.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/013/13.1-\346\212\230\347\272\277\345\233\276\345\222\214\345\217\240\345\212\240\345\214\272\345\237\237\345\233\276.py" @@ -1,17 +1,17 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt - -weeks = pd.read_excel("./example.xlsx", index_col="Week") -print(weeks) -print(weeks.columns) -# weeks.plot(y=['Accessories', 'Bikes', 'Clothing', 'Components']) -weeks.plot.area(y=['Accessories', 'Bikes', 'Clothing', 'Components']) -# weeks.plot.bar(y=['Accessories', 'Bikes', 'Clothing', 'Components'],stacked=True) -plt.title("Sales Weekly Trend", fontsize=16, fontweight="bold") -plt.ylabel("Total", fontsize=12, fontweight="bold") -plt.xticks(weeks.index, fontsize=8) -plt.show() +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt + +weeks = pd.read_excel("./example.xlsx", index_col="Week") +print(weeks) +print(weeks.columns) +# weeks.plot(y=['Accessories', 'Bikes', 'Clothing', 'Components']) +weeks.plot.area(y=['Accessories', 'Bikes', 'Clothing', 'Components']) +# weeks.plot.bar(y=['Accessories', 'Bikes', 'Clothing', 'Components'],stacked=True) +plt.title("Sales Weekly Trend", fontsize=16, fontweight="bold") +plt.ylabel("Total", fontsize=12, fontweight="bold") +plt.xticks(weeks.index, fontsize=8) +plt.show() diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/013/example.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/013/example.xlsx" new file mode 100644 index 0000000..58885b0 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/013/example.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/014\241\242015/14.1-\311\242\265\343\315\274.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/14.1-\346\225\243\347\202\271\345\233\276.py" similarity index 78% rename from "course/PandasVersusExcel-Code/014\241\242015/14.1-\311\242\265\343\315\274.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/14.1-\346\225\243\347\202\271\345\233\276.py" index a3c8841..cc581b0 100644 --- "a/course/PandasVersusExcel-Code/014\241\242015/14.1-\311\242\265\343\315\274.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/14.1-\346\225\243\347\202\271\345\233\276.py" @@ -1,12 +1,12 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt - -pd.options.display.max_columns = 777 -homes = pd.read_excel("./home_data.xlsx") -print(homes.head()) -homes.plot.scatter(x="sqft_living", y="price") -plt.show() +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt + +pd.options.display.max_columns = 777 +homes = pd.read_excel("./home_data.xlsx") +print(homes.head()) +homes.plot.scatter(x="sqft_living", y="price") +plt.show() diff --git "a/course/PandasVersusExcel-Code/014\241\242015/15.1-\326\261\267\275\315\274.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/15.1-\347\233\264\346\226\271\345\233\276.py" similarity index 81% rename from "course/PandasVersusExcel-Code/014\241\242015/15.1-\326\261\267\275\315\274.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/15.1-\347\233\264\346\226\271\345\233\276.py" index a7bd7af..c088413 100644 --- "a/course/PandasVersusExcel-Code/014\241\242015/15.1-\326\261\267\275\315\274.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/15.1-\347\233\264\346\226\271\345\233\276.py" @@ -1,13 +1,13 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt - -pd.options.display.max_columns = 777 -homes = pd.read_excel("./home_data.xlsx") -print(homes.head()) -homes.sqft_living.plot.hist(bins=100) -plt.xticks(range(0, max(homes.sqft_living), 500), fontsize=8, rotation=90) -plt.show() +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt + +pd.options.display.max_columns = 777 +homes = pd.read_excel("./home_data.xlsx") +print(homes.head()) +homes.sqft_living.plot.hist(bins=100) +plt.xticks(range(0, max(homes.sqft_living), 500), fontsize=8, rotation=90) +plt.show() diff --git "a/course/PandasVersusExcel-Code/014\241\242015/15.2-\303\334\266\310\315\274.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/15.2-\345\257\206\345\272\246\345\233\276.py" similarity index 80% rename from "course/PandasVersusExcel-Code/014\241\242015/15.2-\303\334\266\310\315\274.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/15.2-\345\257\206\345\272\246\345\233\276.py" index af61183..dfe56b8 100644 --- "a/course/PandasVersusExcel-Code/014\241\242015/15.2-\303\334\266\310\315\274.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/15.2-\345\257\206\345\272\246\345\233\276.py" @@ -1,13 +1,13 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt - -pd.options.display.max_columns = 777 -homes = pd.read_excel("./home_data.xlsx") -print(homes.head()) -homes.sqft_living.plot.kde() -plt.xticks(range(0, max(homes.sqft_living), 500), fontsize=8, rotation=90) -plt.show() +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt + +pd.options.display.max_columns = 777 +homes = pd.read_excel("./home_data.xlsx") +print(homes.head()) +homes.sqft_living.plot.kde() +plt.xticks(range(0, max(homes.sqft_living), 500), fontsize=8, rotation=90) +plt.show() diff --git "a/course/PandasVersusExcel-Code/014\241\242015/15.3-\317\340\271\330\320\324.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/15.3-\347\233\270\345\205\263\346\200\247.py" similarity index 76% rename from "course/PandasVersusExcel-Code/014\241\242015/15.3-\317\340\271\330\320\324.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/15.3-\347\233\270\345\205\263\346\200\247.py" index 51a6827..5d50435 100644 --- "a/course/PandasVersusExcel-Code/014\241\242015/15.3-\317\340\271\330\320\324.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/15.3-\347\233\270\345\205\263\346\200\247.py" @@ -1,10 +1,10 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt - -pd.options.display.max_columns = 777 -homes = pd.read_excel("./home_data.xlsx") -print(homes.corr()) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt + +pd.options.display.max_columns = 777 +homes = pd.read_excel("./home_data.xlsx") +print(homes.corr()) diff --git "a/course/PandasVersusExcel-Code/014\241\242015/home_data.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/home_data.xlsx" similarity index 100% rename from "course/PandasVersusExcel-Code/014\241\242015/home_data.xlsx" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/014\343\200\201015/home_data.xlsx" diff --git "a/course/PandasVersusExcel-Code/016/16.1-\266\340\261\355\301\252\301\242\243\250merge\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/016/16.1-\345\244\232\350\241\250\350\201\224\347\253\213\357\274\210merge\357\274\211.py" similarity index 81% rename from "course/PandasVersusExcel-Code/016/16.1-\266\340\261\355\301\252\301\242\243\250merge\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/016/16.1-\345\244\232\350\241\250\350\201\224\347\253\213\357\274\210merge\357\274\211.py" index a586036..817117b 100644 --- "a/course/PandasVersusExcel-Code/016/16.1-\266\340\261\355\301\252\301\242\243\250merge\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/016/16.1-\345\244\232\350\241\250\350\201\224\347\253\213\357\274\210merge\357\274\211.py" @@ -1,11 +1,11 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -students = pd.read_excel('./Student_score.xlsx', sheet_name='Students') -scores = pd.read_excel('./Student_score.xlsx', sheet_name='Scores') -table = students.merge(scores, how="left", on="ID").fillna(0) -table.Score = table.Score.astype(int) -print(table) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +students = pd.read_excel('./Student_score.xlsx', sheet_name='Students') +scores = pd.read_excel('./Student_score.xlsx', sheet_name='Scores') +table = students.merge(scores, how="left", on="ID").fillna(0) +table.Score = table.Score.astype(int) +print(table) diff --git "a/course/PandasVersusExcel-Code/016/16.2-\266\340\261\355\301\252\301\242\243\250join\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/016/16.2-\345\244\232\350\241\250\350\201\224\347\253\213\357\274\210join\357\274\211.py" similarity index 82% rename from "course/PandasVersusExcel-Code/016/16.2-\266\340\261\355\301\252\301\242\243\250join\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/016/16.2-\345\244\232\350\241\250\350\201\224\347\253\213\357\274\210join\357\274\211.py" index 66a56e2..8786e4e 100644 --- "a/course/PandasVersusExcel-Code/016/16.2-\266\340\261\355\301\252\301\242\243\250join\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/016/16.2-\345\244\232\350\241\250\350\201\224\347\253\213\357\274\210join\357\274\211.py" @@ -1,11 +1,11 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -students = pd.read_excel('./Student_score.xlsx', sheet_name='Students', index_col='ID') -scores = pd.read_excel('./Student_score.xlsx', sheet_name='Scores', index_col='ID') -table = students.join(scores, how='left').fillna(0) -table.Score = table.Score.astype(int) -print(table) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +students = pd.read_excel('./Student_score.xlsx', sheet_name='Students', index_col='ID') +scores = pd.read_excel('./Student_score.xlsx', sheet_name='Scores', index_col='ID') +table = students.join(scores, how='left').fillna(0) +table.Score = table.Score.astype(int) +print(table) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/016/Student_Score.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/016/Student_Score.xlsx" new file mode 100644 index 0000000..242ea58 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/016/Student_Score.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/017/17.1-\312\375\276\335\320\243\321\351.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/017/17.1-\346\225\260\346\215\256\346\240\241\351\252\214.py" similarity index 81% rename from "course/PandasVersusExcel-Code/017/17.1-\312\375\276\335\320\243\321\351.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/017/17.1-\346\225\260\346\215\256\346\240\241\351\252\214.py" index 6c27af2..e59718a 100644 --- "a/course/PandasVersusExcel-Code/017/17.1-\312\375\276\335\320\243\321\351.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/017/17.1-\346\225\260\346\215\256\346\240\241\351\252\214.py" @@ -1,17 +1,17 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - - -def score_valication(row): - try: - assert 0 <= row.Score <= 100 - except: - print(f'#{row.ID}\tstudent {row.Name} has an invalid score {row.Score}') - - -students = pd.read_excel('./Students.xlsx') -print(students) -students.apply(score_valication, axis=1) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + + +def score_valication(row): + try: + assert 0 <= row.Score <= 100 + except: + print(f'#{row.ID}\tstudent {row.Name} has an invalid score {row.Score}') + + +students = pd.read_excel('./Students.xlsx') +print(students) +students.apply(score_valication, axis=1) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/017/Students.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/017/Students.xlsx" new file mode 100644 index 0000000..de63db6 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/017/Students.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/018/18.1-\312\375\276\335\267\326\301\320.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/018/18.1-\346\225\260\346\215\256\345\210\206\345\210\227.py" similarity index 79% rename from "course/PandasVersusExcel-Code/018/18.1-\312\375\276\335\267\326\301\320.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/018/18.1-\346\225\260\346\215\256\345\210\206\345\210\227.py" index 8a469bf..4e10ea1 100644 --- "a/course/PandasVersusExcel-Code/018/18.1-\312\375\276\335\267\326\301\320.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/018/18.1-\346\225\260\346\215\256\345\210\206\345\210\227.py" @@ -1,12 +1,12 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -employees = pd.read_excel('Employees.xlsx', index_col='ID') -df = employees['Full Name'].str.split(expand=True) -# print(df) -employees['First Name'] = df[0] -employees['Last Name'] = df[1] -print(employees) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +employees = pd.read_excel('Employees.xlsx', index_col='ID') +df = employees['Full Name'].str.split(expand=True) +# print(df) +employees['First Name'] = df[0] +employees['Last Name'] = df[1] +print(employees) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/018/Employees.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/018/Employees.xlsx" new file mode 100644 index 0000000..511dc9a Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/018/Employees.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/019/19.1-\306\275\276\371\267\326\241\242\327\334\267\326.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/019/19.1-\345\271\263\345\235\207\345\210\206\343\200\201\346\200\273\345\210\206.py" similarity index 85% rename from "course/PandasVersusExcel-Code/019/19.1-\306\275\276\371\267\326\241\242\327\334\267\326.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/019/19.1-\345\271\263\345\235\207\345\210\206\343\200\201\346\200\273\345\210\206.py" index 3507df2..5aaed3e 100644 --- "a/course/PandasVersusExcel-Code/019/19.1-\306\275\276\371\267\326\241\242\327\334\267\326.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/019/19.1-\345\271\263\345\235\207\345\210\206\343\200\201\346\200\273\345\210\206.py" @@ -1,17 +1,17 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -students = pd.read_excel('./Students.xlsx', index_col='ID') -temp = students[['Test_1', 'Test_2', 'Test_3']] -row_sum = temp.sum(axis=1) -row_mean = temp.mean(axis=1) -students['Total'] = row_sum -students['Average'] = row_mean -col_mean = students[['Test_1', 'Test_2', 'Test_3', 'Total', 'Average']].mean() -print(col_mean) -col_mean['Name'] = 'Summary' # 进行命名 -students = students.append(col_mean, ignore_index=True) -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +students = pd.read_excel('./Students.xlsx', index_col='ID') +temp = students[['Test_1', 'Test_2', 'Test_3']] +row_sum = temp.sum(axis=1) +row_mean = temp.mean(axis=1) +students['Total'] = row_sum +students['Average'] = row_mean +col_mean = students[['Test_1', 'Test_2', 'Test_3', 'Total', 'Average']].mean() +print(col_mean) +col_mean['Name'] = 'Summary' # 进行命名 +students = students.append(col_mean, ignore_index=True) +print(students) diff --git "a/course/PandasVersusExcel-Code/025\241\242026/Students.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/019/Students.xlsx" similarity index 100% rename from "course/PandasVersusExcel-Code/025\241\242026/Students.xlsx" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/019/Students.xlsx" diff --git "a/course/PandasVersusExcel-Code/020/20.1-\312\375\276\335\310\245\326\330.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/020/20.1-\346\225\260\346\215\256\345\216\273\351\207\215.py" similarity index 76% rename from "course/PandasVersusExcel-Code/020/20.1-\312\375\276\335\310\245\326\330.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/020/20.1-\346\225\260\346\215\256\345\216\273\351\207\215.py" index 8fef8d2..2fb2aae 100644 --- "a/course/PandasVersusExcel-Code/020/20.1-\312\375\276\335\310\245\326\330.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/020/20.1-\346\225\260\346\215\256\345\216\273\351\207\215.py" @@ -1,9 +1,9 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -students = pd.read_excel('Students_Duplicates.xlsx') -students.drop_duplicates(subset='Name', inplace=True, keep="first") -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +students = pd.read_excel('Students_Duplicates.xlsx') +students.drop_duplicates(subset='Name', inplace=True, keep="first") +print(students) diff --git "a/course/PandasVersusExcel-Code/020/20.2-\325\322\263\366\326\330\270\264\312\375\276\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/020/20.2-\346\211\276\345\207\272\351\207\215\345\244\215\346\225\260\346\215\256.py" similarity index 78% rename from "course/PandasVersusExcel-Code/020/20.2-\325\322\263\366\326\330\270\264\312\375\276\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/020/20.2-\346\211\276\345\207\272\351\207\215\345\244\215\346\225\260\346\215\256.py" index 8616a90..d2e8e4c 100644 --- "a/course/PandasVersusExcel-Code/020/20.2-\325\322\263\366\326\330\270\264\312\375\276\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/020/20.2-\346\211\276\345\207\272\351\207\215\345\244\215\346\225\260\346\215\256.py" @@ -1,11 +1,11 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -students = pd.read_excel('Students_Duplicates.xlsx') -dupe = students.duplicated(subset='Name') -print(dupe.any()) -dupe = dupe[dupe == True] -print(students.iloc[dupe.index]) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +students = pd.read_excel('Students_Duplicates.xlsx') +dupe = students.duplicated(subset='Name') +print(dupe.any()) +dupe = dupe[dupe == True] +print(students.iloc[dupe.index]) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/020/Students_Duplicates.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/020/Students_Duplicates.xlsx" new file mode 100644 index 0000000..869c7aa Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/020/Students_Duplicates.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/021/21.1-\320\375\327\252\312\375\276\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/021/21.1-\346\227\213\350\275\254\346\225\260\346\215\256.py" similarity index 76% rename from "course/PandasVersusExcel-Code/021/21.1-\320\375\327\252\312\375\276\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/021/21.1-\346\227\213\350\275\254\346\225\260\346\215\256.py" index b164871..ea2c1f7 100644 --- "a/course/PandasVersusExcel-Code/021/21.1-\320\375\327\252\312\375\276\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/021/21.1-\346\227\213\350\275\254\346\225\260\346\215\256.py" @@ -1,10 +1,10 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -pd.options.display.max_columns = 999 -videos = pd.read_excel('Videos.xlsx', index_col='Month') -table = videos.transpose() -print(table) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +pd.options.display.max_columns = 999 +videos = pd.read_excel('Videos.xlsx', index_col='Month') +table = videos.transpose() +print(table) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/021/Videos.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/021/Videos.xlsx" new file mode 100644 index 0000000..8fead9f Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/021/Videos.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/022/22.1-\266\301\310\241csv\316\304\274\376\326\320\265\304\312\375\276\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/22.1-\350\257\273\345\217\226csv\346\226\207\344\273\266\344\270\255\347\232\204\346\225\260\346\215\256.py" similarity index 73% rename from "course/PandasVersusExcel-Code/022/22.1-\266\301\310\241csv\316\304\274\376\326\320\265\304\312\375\276\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/22.1-\350\257\273\345\217\226csv\346\226\207\344\273\266\344\270\255\347\232\204\346\225\260\346\215\256.py" index d711761..726a685 100644 --- "a/course/PandasVersusExcel-Code/022/22.1-\266\301\310\241csv\316\304\274\376\326\320\265\304\312\375\276\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/22.1-\350\257\273\345\217\226csv\346\226\207\344\273\266\344\270\255\347\232\204\346\225\260\346\215\256.py" @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -students1 = pd.read_csv('./Students.csv', index_col='ID') -print(students1) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +students1 = pd.read_csv('./Students.csv', index_col='ID') +print(students1) diff --git "a/course/PandasVersusExcel-Code/022/22.2-\266\301\310\241tsv\316\304\274\376\326\320\265\304\312\375\276\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/22.2-\350\257\273\345\217\226tsv\346\226\207\344\273\266\344\270\255\347\232\204\346\225\260\346\215\256.py" similarity index 73% rename from "course/PandasVersusExcel-Code/022/22.2-\266\301\310\241tsv\316\304\274\376\326\320\265\304\312\375\276\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/22.2-\350\257\273\345\217\226tsv\346\226\207\344\273\266\344\270\255\347\232\204\346\225\260\346\215\256.py" index e23abbd..0ba037a 100644 --- "a/course/PandasVersusExcel-Code/022/22.2-\266\301\310\241tsv\316\304\274\376\326\320\265\304\312\375\276\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/22.2-\350\257\273\345\217\226tsv\346\226\207\344\273\266\344\270\255\347\232\204\346\225\260\346\215\256.py" @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -students2 = pd.read_csv('Students.tsv', sep='\t', index_col='ID') -print(students2) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +students2 = pd.read_csv('Students.tsv', sep='\t', index_col='ID') +print(students2) diff --git "a/course/PandasVersusExcel-Code/022/22.3-\266\301\310\241txt\316\304\274\376\326\320\265\304\312\375\276\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/22.3-\350\257\273\345\217\226txt\346\226\207\344\273\266\344\270\255\347\232\204\346\225\260\346\215\256.py" similarity index 74% rename from "course/PandasVersusExcel-Code/022/22.3-\266\301\310\241txt\316\304\274\376\326\320\265\304\312\375\276\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/22.3-\350\257\273\345\217\226txt\346\226\207\344\273\266\344\270\255\347\232\204\346\225\260\346\215\256.py" index f537a3f..236fef4 100644 --- "a/course/PandasVersusExcel-Code/022/22.3-\266\301\310\241txt\316\304\274\376\326\320\265\304\312\375\276\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/22.3-\350\257\273\345\217\226txt\346\226\207\344\273\266\344\270\255\347\232\204\346\225\260\346\215\256.py" @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -students3 = pd.read_csv('./Students.txt', sep='|', index_col='ID') -print(students3) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +students3 = pd.read_csv('./Students.txt', sep='|', index_col='ID') +print(students3) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/Students.csv" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/Students.csv" new file mode 100644 index 0000000..8c68d0d --- /dev/null +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/Students.csv" @@ -0,0 +1,21 @@ +ID,Name,Age +1,Student_001,21 +2,Student_002,22 +3,Student_003,23 +4,Student_004,24 +5,Student_005,25 +6,Student_006,26 +7,Student_007,27 +8,Student_008,28 +9,Student_009,29 +10,Student_010,30 +11,Student_011,31 +12,Student_012,32 +13,Student_013,33 +14,Student_014,34 +15,Student_015,35 +16,Student_016,36 +17,Student_017,37 +18,Student_018,38 +19,Student_019,39 +20,Student_020,40 diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/Students.tsv" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/Students.tsv" new file mode 100644 index 0000000..7461da8 --- /dev/null +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/Students.tsv" @@ -0,0 +1,4 @@ +ID Name Age +1 Student_001 21 +2 Student_002 22 +3 Student_003 23 diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/Students.txt" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/Students.txt" new file mode 100644 index 0000000..4752e1b --- /dev/null +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/022/Students.txt" @@ -0,0 +1,21 @@ +ID|Name|Age +1|Student_001|21 +2|Student_002|22 +3|Student_003|23 +4|Student_004|24 +5|Student_005|25 +6|Student_006|26 +7|Student_007|27 +8|Student_008|28 +9|Student_009|29 +10|Student_010|30 +11|Student_011|31 +12|Student_012|32 +13|Student_013|33 +14|Student_014|34 +15|Student_015|35 +16|Student_016|36 +17|Student_017|37 +18|Student_018|38 +19|Student_019|39 +20|Student_020|40 diff --git "a/course/PandasVersusExcel-Code/023/23.1-\312\375\276\335\315\270\312\323\261\355.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/023/23.1-\346\225\260\346\215\256\351\200\217\350\247\206\350\241\250.py" similarity index 85% rename from "course/PandasVersusExcel-Code/023/23.1-\312\375\276\335\315\270\312\323\261\355.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/023/23.1-\346\225\260\346\215\256\351\200\217\350\247\206\350\241\250.py" index 5a3a292..5b3d651 100644 --- "a/course/PandasVersusExcel-Code/023/23.1-\312\375\276\335\315\270\312\323\261\355.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/023/23.1-\346\225\260\346\215\256\351\200\217\350\247\206\350\241\250.py" @@ -1,18 +1,18 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -from datetime import date -import numpy as np - -pd.options.display.max_columns = 999 -orders = pd.read_excel('./Orders.xlsx') -orders['Year'] = pd.DatetimeIndex(orders.Date).year -pt1 = orders.pivot_table(index='Category', columns='Year', values='Total', aggfunc=np.sum) -print(pt1) -groups = orders.groupby(['Category', 'Year']) -s = groups['Total'].sum() -c = groups['ID'].count() -pt2 = pd.DataFrame({'Sum': s, 'Count': c}) -print(pt2) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +from datetime import date +import numpy as np + +pd.options.display.max_columns = 999 +orders = pd.read_excel('./Orders.xlsx') +orders['Year'] = pd.DatetimeIndex(orders.Date).year +pt1 = orders.pivot_table(index='Category', columns='Year', values='Total', aggfunc=np.sum) +print(pt1) +groups = orders.groupby(['Category', 'Year']) +s = groups['Total'].sum() +c = groups['ID'].count() +pt2 = pd.DataFrame({'Sum': s, 'Count': c}) +print(pt2) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/023/Orders.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/023/Orders.xlsx" new file mode 100644 index 0000000..bc75f45 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/023/Orders.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/024/24.1-\317\337\320\324\273\330\271\351.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/024/24.1-\347\272\277\346\200\247\345\233\236\345\275\222.py" similarity index 88% rename from "course/PandasVersusExcel-Code/024/24.1-\317\337\320\324\273\330\271\351.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/024/24.1-\347\272\277\346\200\247\345\233\236\345\275\222.py" index 834e828..262b534 100644 --- "a/course/PandasVersusExcel-Code/024/24.1-\317\337\320\324\273\330\271\351.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/024/24.1-\347\272\277\346\200\247\345\233\236\345\275\222.py" @@ -1,23 +1,23 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import matplotlib.pyplot as plt -from scipy.stats import linregress - -sales = pd.read_excel('./Sales.xlsx', dtype={'Month': str}) -print(sales) -# plt.bar(sales.index, sales.Revenue) -# plt.title("Sales") -# plt.xticks(sales.index, sales.Month, rotation=90) -# plt.tight_layout() -# plt.show() -slope, intercept, r, p, std_err = linregress(sales.index, sales.Revenue) # slope:斜率 intercept:截距 -exp = sales.index * slope + intercept -print("2019年12月预计销售额:" + str(slope * 35 + intercept)) -plt.scatter(sales.index, sales.Revenue) -plt.plot(sales.index, exp, color='orange') -plt.title(f"y={slope}*x+{intercept}") -plt.xticks(sales.index, sales.Month, rotation=90) -plt.show() +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import matplotlib.pyplot as plt +from scipy.stats import linregress + +sales = pd.read_excel('./Sales.xlsx', dtype={'Month': str}) +print(sales) +# plt.bar(sales.index, sales.Revenue) +# plt.title("Sales") +# plt.xticks(sales.index, sales.Month, rotation=90) +# plt.tight_layout() +# plt.show() +slope, intercept, r, p, std_err = linregress(sales.index, sales.Revenue) # slope:斜率 intercept:截距 +exp = sales.index * slope + intercept +print("2019年12月预计销售额:" + str(slope * 35 + intercept)) +plt.scatter(sales.index, sales.Revenue) +plt.plot(sales.index, exp, color='orange') +plt.title(f"y={slope}*x+{intercept}") +plt.xticks(sales.index, sales.Month, rotation=90) +plt.show() diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/024/Sales.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/024/Sales.xlsx" new file mode 100644 index 0000000..7f2719b Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/024/Sales.xlsx" differ diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/025\343\200\201026/Students.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/025\343\200\201026/Students.xlsx" new file mode 100644 index 0000000..0219afe Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/025\343\200\201026/Students.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/025\241\242026/\314\365\274\376\270\361\312\275.ipynb" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/025\343\200\201026/\346\235\241\344\273\266\346\240\274\345\274\217.ipynb" similarity index 100% rename from "course/PandasVersusExcel-Code/025\241\242026/\314\365\274\376\270\361\312\275.ipynb" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/025\343\200\201026/\346\235\241\344\273\266\346\240\274\345\274\217.ipynb" diff --git "a/course/PandasVersusExcel-Code/027/27.1-\320\320\327\267\274\323\304\332\310\335\243\250\322\321\323\320\304\332\310\335\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.1-\350\241\214\350\277\275\345\212\240\345\206\205\345\256\271\357\274\210\345\267\262\346\234\211\345\206\205\345\256\271\357\274\211.py" similarity index 79% rename from "course/PandasVersusExcel-Code/027/27.1-\320\320\327\267\274\323\304\332\310\335\243\250\322\321\323\320\304\332\310\335\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.1-\350\241\214\350\277\275\345\212\240\345\206\205\345\256\271\357\274\210\345\267\262\346\234\211\345\206\205\345\256\271\357\274\211.py" index 5a011de..9e31749 100644 --- "a/course/PandasVersusExcel-Code/027/27.1-\320\320\327\267\274\323\304\332\310\335\243\250\322\321\323\320\304\332\310\335\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.1-\350\241\214\350\277\275\345\212\240\345\206\205\345\256\271\357\274\210\345\267\262\346\234\211\345\206\205\345\256\271\357\274\211.py" @@ -1,11 +1,11 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') - -students = page_001.append(page_002).reset_index(drop=True) -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') + +students = page_001.append(page_002).reset_index(drop=True) +print(students) diff --git "a/course/PandasVersusExcel-Code/027/27.2-\320\320\327\267\274\323\304\332\310\335\243\250\320\302\304\332\310\335\243\251.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.2-\350\241\214\350\277\275\345\212\240\345\206\205\345\256\271\357\274\210\346\226\260\345\206\205\345\256\271\357\274\211.py" similarity index 83% rename from "course/PandasVersusExcel-Code/027/27.2-\320\320\327\267\274\323\304\332\310\335\243\250\320\302\304\332\310\335\243\251.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.2-\350\241\214\350\277\275\345\212\240\345\206\205\345\256\271\357\274\210\346\226\260\345\206\205\345\256\271\357\274\211.py" index 876de3d..f99fec1 100644 --- "a/course/PandasVersusExcel-Code/027/27.2-\320\320\327\267\274\323\304\332\310\335\243\250\320\302\304\332\310\335\243\251.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.2-\350\241\214\350\277\275\345\212\240\345\206\205\345\256\271\357\274\210\346\226\260\345\206\205\345\256\271\357\274\211.py" @@ -1,13 +1,13 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = page_001.append(page_002).reset_index(drop=True) - -stu = pd.Series({'ID': 41, 'Name': 'Abel', 'Score': 99}) -students = students.append(stu, ignore_index=True) -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = page_001.append(page_002).reset_index(drop=True) + +stu = pd.Series({'ID': 41, 'Name': 'Abel', 'Score': 99}) +students = students.append(stu, ignore_index=True) +print(students) diff --git "a/course/PandasVersusExcel-Code/027/27.3-\320\320\320\336\270\304\304\332\310\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.3-\350\241\214\344\277\256\346\224\271\345\206\205\345\256\271.py" similarity index 86% rename from "course/PandasVersusExcel-Code/027/27.3-\320\320\320\336\270\304\304\332\310\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.3-\350\241\214\344\277\256\346\224\271\345\206\205\345\256\271.py" index 096a96e..bc7f4ed 100644 --- "a/course/PandasVersusExcel-Code/027/27.3-\320\320\320\336\270\304\304\332\310\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.3-\350\241\214\344\277\256\346\224\271\345\206\205\345\256\271.py" @@ -1,17 +1,17 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = page_001.append(page_002).reset_index(drop=True) -stu = pd.Series({'ID': 41, 'Name': 'Abel', 'Score': 90}) -students = students.append(stu, ignore_index=True) - -students.at[39, "Name"] = "Bailey" -students.at[39, "Score"] = "120" # 修改内容 -stu = pd.Series({'ID': 39, 'Name': 'Ammy', 'Score': 150}) -students.iloc[38] = stu # 替换整行 -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = page_001.append(page_002).reset_index(drop=True) +stu = pd.Series({'ID': 41, 'Name': 'Abel', 'Score': 90}) +students = students.append(stu, ignore_index=True) + +students.at[39, "Name"] = "Bailey" +students.at[39, "Score"] = "120" # 修改内容 +stu = pd.Series({'ID': 39, 'Name': 'Ammy', 'Score': 150}) +students.iloc[38] = stu # 替换整行 +print(students) diff --git "a/course/PandasVersusExcel-Code/027/27.4-\320\320\262\345\310\353\304\332\310\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.4-\350\241\214\346\217\222\345\205\245\345\206\205\345\256\271.py" similarity index 88% rename from "course/PandasVersusExcel-Code/027/27.4-\320\320\262\345\310\353\304\332\310\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.4-\350\241\214\346\217\222\345\205\245\345\206\205\345\256\271.py" index 94a6aba..86f40ba 100644 --- "a/course/PandasVersusExcel-Code/027/27.4-\320\320\262\345\310\353\304\332\310\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.4-\350\241\214\346\217\222\345\205\245\345\206\205\345\256\271.py" @@ -1,21 +1,21 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = page_001.append(page_002).reset_index(drop=True) -stu = pd.Series({'ID': 41, 'Name': 'Abel', 'Score': 90}) -students = students.append(stu, ignore_index=True) -students.at[39, "Name"] = "Bailey" -students.at[39, "Score"] = "120" # 修改内容 -stu = pd.Series({'ID': 39, 'Name': 'Ammy', 'Score': 150}) -students.iloc[38] = stu # 替换整行 - -stu = pd.Series({'ID': 101, 'Name': 'Danni', 'Score': 101}) -part1 = students[:20] -part2 = students[20:] -students = part1.append(stu, ignore_index=True).append(part2).reset_index(drop=True) -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = page_001.append(page_002).reset_index(drop=True) +stu = pd.Series({'ID': 41, 'Name': 'Abel', 'Score': 90}) +students = students.append(stu, ignore_index=True) +students.at[39, "Name"] = "Bailey" +students.at[39, "Score"] = "120" # 修改内容 +stu = pd.Series({'ID': 39, 'Name': 'Ammy', 'Score': 150}) +students.iloc[38] = stu # 替换整行 + +stu = pd.Series({'ID': 101, 'Name': 'Danni', 'Score': 101}) +part1 = students[:20] +part2 = students[20:] +students = part1.append(stu, ignore_index=True).append(part2).reset_index(drop=True) +print(students) diff --git "a/course/PandasVersusExcel-Code/027/27.5-\320\320\311\276\263\375\304\332\310\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.5-\350\241\214\345\210\240\351\231\244\345\206\205\345\256\271.py" similarity index 89% rename from "course/PandasVersusExcel-Code/027/27.5-\320\320\311\276\263\375\304\332\310\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.5-\350\241\214\345\210\240\351\231\244\345\206\205\345\256\271.py" index badc8db..cb990d3 100644 --- "a/course/PandasVersusExcel-Code/027/27.5-\320\320\311\276\263\375\304\332\310\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.5-\350\241\214\345\210\240\351\231\244\345\206\205\345\256\271.py" @@ -1,23 +1,23 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = page_001.append(page_002).reset_index(drop=True) -stu = pd.Series({'ID': 41, 'Name': 'Abel', 'Score': 90}) -students = students.append(stu, ignore_index=True) -students.at[39, "Name"] = "Bailey" -students.at[39, "Score"] = "120" # 修改内容 -stu = pd.Series({'ID': 39, 'Name': 'Ammy', 'Score': 150}) -students.iloc[38] = stu # 替换整行 -stu = pd.Series({'ID': 101, 'Name': 'Danni', 'Score': 101}) -part1 = students[:20] # .iloc[] is the same -part2 = students[20:] -students = part1.append(stu, ignore_index=True).append(part2).reset_index(drop=True) - -students.drop(index=[0, 1, 2], inplace=True) -students.drop(index=students[0:7].index, inplace=True) # 切片 -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = page_001.append(page_002).reset_index(drop=True) +stu = pd.Series({'ID': 41, 'Name': 'Abel', 'Score': 90}) +students = students.append(stu, ignore_index=True) +students.at[39, "Name"] = "Bailey" +students.at[39, "Score"] = "120" # 修改内容 +stu = pd.Series({'ID': 39, 'Name': 'Ammy', 'Score': 150}) +students.iloc[38] = stu # 替换整行 +stu = pd.Series({'ID': 101, 'Name': 'Danni', 'Score': 101}) +part1 = students[:20] # .iloc[] is the same +part2 = students[20:] +students = part1.append(stu, ignore_index=True).append(part2).reset_index(drop=True) + +students.drop(index=[0, 1, 2], inplace=True) +students.drop(index=students[0:7].index, inplace=True) # 切片 +print(students) diff --git "a/course/PandasVersusExcel-Code/027/27.6-\320\320\270\275\314\365\274\376\311\276\263\375.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.6-\350\241\214\351\231\204\346\235\241\344\273\266\345\210\240\351\231\244.py" similarity index 90% rename from "course/PandasVersusExcel-Code/027/27.6-\320\320\270\275\314\365\274\376\311\276\263\375.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.6-\350\241\214\351\231\204\346\235\241\344\273\266\345\210\240\351\231\244.py" index 74b667d..16330de 100644 --- "a/course/PandasVersusExcel-Code/027/27.6-\320\320\270\275\314\365\274\376\311\276\263\375.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/27.6-\350\241\214\351\231\204\346\235\241\344\273\266\345\210\240\351\231\244.py" @@ -1,27 +1,27 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = page_001.append(page_002).reset_index(drop=True) -stu = pd.Series({'ID': 41, 'Name': 'Abel', 'Score': 90}) -students = students.append(stu, ignore_index=True) -students.at[39, "Name"] = "Bailey" -students.at[39, "Score"] = "120" # 修改内容 -stu = pd.Series({'ID': 39, 'Name': 'Ammy', 'Score': 150}) -students.iloc[38] = stu # 替换整行 -stu = pd.Series({'ID': 101, 'Name': 'Danni', 'Score': 101}) -part1 = students[:20] # .iloc[] is the same -part2 = students[20:] -students = part1.append(stu, ignore_index=True).append(part2).reset_index(drop=True) - -for i in range(5, 15): - students['Name'].at[i] = '' -missing = students.loc[students['Name'] == ''] -students.drop(missing.index, inplace=True) -students = students.reset_index(drop=True) -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = page_001.append(page_002).reset_index(drop=True) +stu = pd.Series({'ID': 41, 'Name': 'Abel', 'Score': 90}) +students = students.append(stu, ignore_index=True) +students.at[39, "Name"] = "Bailey" +students.at[39, "Score"] = "120" # 修改内容 +stu = pd.Series({'ID': 39, 'Name': 'Ammy', 'Score': 150}) +students.iloc[38] = stu # 替换整行 +stu = pd.Series({'ID': 101, 'Name': 'Danni', 'Score': 101}) +part1 = students[:20] # .iloc[] is the same +part2 = students[20:] +students = part1.append(stu, ignore_index=True).append(part2).reset_index(drop=True) + +for i in range(5, 15): + students['Name'].at[i] = '' +missing = students.loc[students['Name'] == ''] +students.drop(missing.index, inplace=True) +students = students.reset_index(drop=True) +print(students) \ No newline at end of file diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/Students.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/Students.xlsx" new file mode 100644 index 0000000..9072e96 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/027/Students.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/028/28.1-\301\320\272\317\262\242\304\332\310\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.1-\345\210\227\345\220\210\345\271\266\345\206\205\345\256\271.py" similarity index 80% rename from "course/PandasVersusExcel-Code/028/28.1-\301\320\272\317\262\242\304\332\310\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.1-\345\210\227\345\220\210\345\271\266\345\206\205\345\256\271.py" index 0649067..133ca3e 100644 --- "a/course/PandasVersusExcel-Code/028/28.1-\301\320\272\317\262\242\304\332\310\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.1-\345\210\227\345\220\210\345\271\266\345\206\205\345\256\271.py" @@ -1,10 +1,10 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = pd.concat([page_001, page_002]).reset_index(drop=True) -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = pd.concat([page_001, page_002]).reset_index(drop=True) +print(students) diff --git "a/course/PandasVersusExcel-Code/028/28.2-\301\320\327\267\274\323\304\332\310\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.2-\345\210\227\350\277\275\345\212\240\345\206\205\345\256\271.py" similarity index 80% rename from "course/PandasVersusExcel-Code/028/28.2-\301\320\327\267\274\323\304\332\310\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.2-\345\210\227\350\277\275\345\212\240\345\206\205\345\256\271.py" index f71f003..839ad4f 100644 --- "a/course/PandasVersusExcel-Code/028/28.2-\301\320\327\267\274\323\304\332\310\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.2-\345\210\227\350\277\275\345\212\240\345\206\205\345\256\271.py" @@ -1,12 +1,12 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = pd.concat([page_001, page_002]).reset_index(drop=True) - -students['Age'] = 25 -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = pd.concat([page_001, page_002]).reset_index(drop=True) + +students['Age'] = 25 +print(students) diff --git "a/course/PandasVersusExcel-Code/028/28.3-\301\320\311\276\263\375\304\332\310\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.3-\345\210\227\345\210\240\351\231\244\345\206\205\345\256\271.py" similarity index 82% rename from "course/PandasVersusExcel-Code/028/28.3-\301\320\311\276\263\375\304\332\310\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.3-\345\210\227\345\210\240\351\231\244\345\206\205\345\256\271.py" index e734e23..50c5ad0 100644 --- "a/course/PandasVersusExcel-Code/028/28.3-\301\320\311\276\263\375\304\332\310\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.3-\345\210\227\345\210\240\351\231\244\345\206\205\345\256\271.py" @@ -1,13 +1,13 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = pd.concat([page_001, page_002]).reset_index(drop=True) -students['Age'] = 25 - -students.drop(columns=['Score', 'Age'], inplace=True) -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = pd.concat([page_001, page_002]).reset_index(drop=True) +students['Age'] = 25 + +students.drop(columns=['Score', 'Age'], inplace=True) +print(students) diff --git "a/course/PandasVersusExcel-Code/028/28.4-\301\320\262\345\310\353\304\332\310\335.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.4-\345\210\227\346\217\222\345\205\245\345\206\205\345\256\271.py" similarity index 84% rename from "course/PandasVersusExcel-Code/028/28.4-\301\320\262\345\310\353\304\332\310\335.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.4-\345\210\227\346\217\222\345\205\245\345\206\205\345\256\271.py" index 39e6be9..b3d21d6 100644 --- "a/course/PandasVersusExcel-Code/028/28.4-\301\320\262\345\310\353\304\332\310\335.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.4-\345\210\227\346\217\222\345\205\245\345\206\205\345\256\271.py" @@ -1,15 +1,15 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import numpy as np - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = pd.concat([page_001, page_002]).reset_index(drop=True) -students['Age'] = 25 -students.drop(columns=['Score', 'Age'], inplace=True) - -students.insert(1, column='Foo', value=np.repeat('foo', len(students))) -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import numpy as np + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = pd.concat([page_001, page_002]).reset_index(drop=True) +students['Age'] = 25 +students.drop(columns=['Score', 'Age'], inplace=True) + +students.insert(1, column='Foo', value=np.repeat('foo', len(students))) +print(students) diff --git "a/course/PandasVersusExcel-Code/028/28.5-\301\320\320\336\270\304\301\320\303\373.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.5-\345\210\227\344\277\256\346\224\271\345\210\227\345\220\215.py" similarity index 85% rename from "course/PandasVersusExcel-Code/028/28.5-\301\320\320\336\270\304\301\320\303\373.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.5-\345\210\227\344\277\256\346\224\271\345\210\227\345\220\215.py" index d0da210..7c8ff77 100644 --- "a/course/PandasVersusExcel-Code/028/28.5-\301\320\320\336\270\304\301\320\303\373.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.5-\345\210\227\344\277\256\346\224\271\345\210\227\345\220\215.py" @@ -1,16 +1,16 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import numpy as np - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = pd.concat([page_001, page_002]).reset_index(drop=True) -students['Age'] = 25 -students.drop(columns=['Score', 'Age'], inplace=True) -students.insert(1, column='Foo', value=np.repeat('foo', len(students))) - -students.rename(columns={'Foo': 'FOO', 'Name': 'NAME'}, inplace=True) -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import numpy as np + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = pd.concat([page_001, page_002]).reset_index(drop=True) +students['Age'] = 25 +students.drop(columns=['Score', 'Age'], inplace=True) +students.insert(1, column='Foo', value=np.repeat('foo', len(students))) + +students.rename(columns={'Foo': 'FOO', 'Name': 'NAME'}, inplace=True) +print(students) diff --git "a/course/PandasVersusExcel-Code/028/28.6-\301\320\270\275\314\365\274\376\311\276\263\375.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.6-\345\210\227\351\231\204\346\235\241\344\273\266\345\210\240\351\231\244.py" similarity index 87% rename from "course/PandasVersusExcel-Code/028/28.6-\301\320\270\275\314\365\274\376\311\276\263\375.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.6-\345\210\227\351\231\204\346\235\241\344\273\266\345\210\240\351\231\244.py" index fb833fb..60ce909 100644 --- "a/course/PandasVersusExcel-Code/028/28.6-\301\320\270\275\314\365\274\376\311\276\263\375.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/28.6-\345\210\227\351\231\204\346\235\241\344\273\266\345\210\240\351\231\244.py" @@ -1,20 +1,20 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import numpy as np - -page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') -page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') -students = pd.concat([page_001, page_002]).reset_index(drop=True) -students['Age'] = 25 -students.drop(columns=['Score', 'Age'], inplace=True) -students.insert(1, column='Foo', value=np.repeat('foo', len(students))) -students.rename(columns={'Foo': 'FOO', 'Name': 'NAME'}, inplace=True) - -students['ID'] = students['ID'].astype(float) -for i in range(5, 15): - students['ID'].at[i] = np.nan -students.dropna(inplace=True) -print(students) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import numpy as np + +page_001 = pd.read_excel('Students.xlsx', sheet_name='Page_001') +page_002 = pd.read_excel('Students.xlsx', sheet_name='Page_002') +students = pd.concat([page_001, page_002]).reset_index(drop=True) +students['Age'] = 25 +students.drop(columns=['Score', 'Age'], inplace=True) +students.insert(1, column='Foo', value=np.repeat('foo', len(students))) +students.rename(columns={'Foo': 'FOO', 'Name': 'NAME'}, inplace=True) + +students['ID'] = students['ID'].astype(float) +for i in range(5, 15): + students['ID'].at[i] = np.nan +students.dropna(inplace=True) +print(students) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/Students.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/Students.xlsx" new file mode 100644 index 0000000..9072e96 Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/028/Students.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/029/29.1-\301\264\275\323SQL.Server\312\375\276\335\277\342.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/029/29.1-\351\223\276\346\216\245SQL.Server\346\225\260\346\215\256\345\272\223.py" similarity index 86% rename from "course/PandasVersusExcel-Code/029/29.1-\301\264\275\323SQL.Server\312\375\276\335\277\342.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/029/29.1-\351\223\276\346\216\245SQL.Server\346\225\260\346\215\256\345\272\223.py" index 9866f3f..c1b846c 100644 --- "a/course/PandasVersusExcel-Code/029/29.1-\301\264\275\323SQL.Server\312\375\276\335\277\342.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/029/29.1-\351\223\276\346\216\245SQL.Server\346\225\260\346\215\256\345\272\223.py" @@ -1,17 +1,17 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import pyodbc -import sqlalchemy - -# 由于未安装数据库,此段代码未测试 -query = 'SELECT FirstName, LastName FROM Person.Person' -connection = pyodbc.connect('DRIVER={SQL Server}; SERVER=(local); DATABASE=AdventureWorks;USER=sa;PASSWORD=123456') -df1 = pd.read_sql_query(query, connection) -print(df1.head()) -engine = sqlalchemy.create_engine('mssql+pyodbc://sa:123456@(local)/AdventureWorks?driver=SQL+Server') -df2 = pd.read_sql_query(query, engine) -pd.options.display.max_columns = 999 -print(df2.head()) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import pyodbc +import sqlalchemy + +# 由于未安装数据库,此段代码未测试 +query = 'SELECT FirstName, LastName FROM Person.Person' +connection = pyodbc.connect('DRIVER={SQL Server}; SERVER=(local); DATABASE=AdventureWorks;USER=sa;PASSWORD=123456') +df1 = pd.read_sql_query(query, connection) +print(df1.head()) +engine = sqlalchemy.create_engine('mssql+pyodbc://sa:123456@(local)/AdventureWorks?driver=SQL+Server') +df2 = pd.read_sql_query(query, engine) +pd.options.display.max_columns = 999 +print(df2.head()) diff --git "a/course/PandasVersusExcel-Code/030/30.1-\270\264\324\323\274\306\313\343\301\320.py" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/030/30.1-\345\244\215\346\235\202\350\256\241\347\256\227\345\210\227.py" similarity index 82% rename from "course/PandasVersusExcel-Code/030/30.1-\270\264\324\323\274\306\313\343\301\320.py" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/030/30.1-\345\244\215\346\235\202\350\256\241\347\256\227\345\210\227.py" index f50a2fc..85050f9 100644 --- "a/course/PandasVersusExcel-Code/030/30.1-\270\264\324\323\274\306\313\343\301\320.py" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/030/30.1-\345\244\215\346\235\202\350\256\241\347\256\227\345\210\227.py" @@ -1,20 +1,20 @@ -# -*- coding: utf-8 -*- -# ⭐Python 60套学习资源:http://t.cn/A6xASARf -# 📱公众号 :程序员晚枫 读者交流群:http://www.python4office.cn/wechat-group/ -# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH -import pandas as pd -import numpy as np - - -def get_circumcircle_area(l, h): - r = np.sqrt(l ** 2 + h ** 2) / 2 - return r ** 2 * np.pi - - -def wrapper(row): - return get_circumcircle_area(row['Length'], row['Height']) - - -rects = pd.read_excel('./Rectangles.xlsx', index_col='ID') -rects['CA'] = rects.apply(wrapper, axis=1) -print(rects) +# -*- coding: utf-8 -*- +# ⭐Python 60套学习资源:http://t.cn/A6xASARf +# 📱公众号 :程序员晚枫 读者交流群:https://www.python4office.cn/wechat-group/ +# 🏠2022最新视频:1行代码,实现自动化办公:https://www.bilibili.com/video/BV1pT4y1k7FH +import pandas as pd +import numpy as np + + +def get_circumcircle_area(l, h): + r = np.sqrt(l ** 2 + h ** 2) / 2 + return r ** 2 * np.pi + + +def wrapper(row): + return get_circumcircle_area(row['Length'], row['Height']) + + +rects = pd.read_excel('./Rectangles.xlsx', index_col='ID') +rects['CA'] = rects.apply(wrapper, axis=1) +print(rects) diff --git "a/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/030/Rectangles.xlsx" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/030/Rectangles.xlsx" new file mode 100644 index 0000000..ba5e44e Binary files /dev/null and "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/030/Rectangles.xlsx" differ diff --git "a/course/PandasVersusExcel-Code/\313\265\303\367.txt" "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/\350\257\264\346\230\216.txt" similarity index 99% rename from "course/PandasVersusExcel-Code/\313\265\303\367.txt" rename to "1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/\350\257\264\346\230\216.txt" index b8a96fa..349b5f7 100644 --- "a/course/PandasVersusExcel-Code/\313\265\303\367.txt" +++ "b/1\343\200\201Python\350\207\252\345\212\250\345\214\226\345\212\236\345\205\254--Pandas\347\216\251\350\275\254Excel\357\274\210\345\205\25030\351\233\206\357\274\211/\350\257\264\346\230\216.txt" @@ -1,2 +1,2 @@ -本文件夹内除29讲代码外的所有代码均在Windows10、python3.7.9、pandas==1.3.5环境下测试通过。 +本文件夹内除29讲代码外的所有代码均在Windows10、python3.7.9、pandas==1.3.5环境下测试通过。 anaconda下载地址:https://www.anaconda.com/products/distribution \ No newline at end of file diff --git a/celery/task.py "b/2\343\200\201Anaconda\346\225\260\346\215\256\345\210\206\346\236\220&\344\272\272\345\267\245\346\231\272\350\203\275\346\225\231\347\250\213\357\274\210100\350\256\262\357\274\211/ReadME.md" similarity index 100% rename from celery/task.py rename to "2\343\200\201Anaconda\346\225\260\346\215\256\345\210\206\346\236\220&\344\272\272\345\267\245\346\231\272\350\203\275\346\225\231\347\250\213\357\274\210100\350\256\262\357\274\211/ReadME.md" diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/README.md" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/README.md" new file mode 100644 index 0000000..b2fbd51 --- /dev/null +++ "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/README.md" @@ -0,0 +1,3 @@ +# 给非程序员的Python入门课 + +使用说明:https://www.python4office.cn/python-course/no-coder-init-course/ \ No newline at end of file diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/3\343\200\201python&pycharm\357\274\214\344\270\213\350\275\275\345\222\214\345\256\211\350\243\205.py" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/3\343\200\201python&pycharm\357\274\214\344\270\213\350\275\275\345\222\214\345\256\211\350\243\205.py" new file mode 100644 index 0000000..67a31ec --- /dev/null +++ "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/3\343\200\201python&pycharm\357\274\214\344\270\213\350\275\275\345\222\214\345\256\211\350\243\205.py" @@ -0,0 +1 @@ +print(666) diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/4\343\200\201\347\273\203\344\271\2401\357\274\232\350\207\252\345\212\250\347\224\237\346\210\220excel\346\225\260\346\215\256.py" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/4\343\200\201\347\273\203\344\271\2401\357\274\232\350\207\252\345\212\250\347\224\237\346\210\220excel\346\225\260\346\215\256.py" new file mode 100644 index 0000000..058553d --- /dev/null +++ "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/4\343\200\201\347\273\203\344\271\2401\357\274\232\350\207\252\345\212\250\347\224\237\346\210\220excel\346\225\260\346\215\256.py" @@ -0,0 +1,9 @@ +# pip install python-office -i https://mirrors.aliyun.com/pypi/simple/ -U + +import office + +office.excel.fake2excel(columns=['name', 'text'], rows=20) + +# 参数说明 +# columns:list,每列的数据名称,默认是名称 +# rows:多少行,默认是1 \ No newline at end of file diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/5\343\200\201\345\237\272\346\234\254\346\225\260\346\215\256\346\223\215\344\275\234.py" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/5\343\200\201\345\237\272\346\234\254\346\225\260\346\215\256\346\223\215\344\275\234.py" new file mode 100644 index 0000000..596cf65 --- /dev/null +++ "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/5\343\200\201\345\237\272\346\234\254\346\225\260\346\215\256\346\223\215\344\275\234.py" @@ -0,0 +1,36 @@ +# -*- coding: UTF-8 -*- +''' +@Author :程序员晚枫,B站/抖音/微博/小红书/公众号 +@WeChat :python-office +@Blog :www.python-office.com +@Date :2023/1/3 13:28 +@Description : +''' + +# def = 1+1 +# class = 1+1 +# a = 1+1 +# print(a) + +num = 122 + +1.666 + +a = 'abc' + +'你好' + +ccc = [1, 2, 3] + +bbb = { + '姓名': "小明", + '年龄': "18", +} + +(1, 2) + +a = 200 +b = 100 +c = a == b +print(c) + diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/6\343\200\201\350\256\241\347\256\227\345\231\250.py" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/6\343\200\201\350\256\241\347\256\227\345\231\250.py" new file mode 100644 index 0000000..9bcaa97 --- /dev/null +++ "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/code/6\343\200\201\350\256\241\347\256\227\345\231\250.py" @@ -0,0 +1,23 @@ +# -*- coding: UTF-8 -*- +''' +@Author :程序员晚枫,B站/抖音/微博/小红书/公众号 +@WeChat :python-office +@Blog :www.python-office.com +@Date :2023/1/3 13:50 +@Description : +''' + +a = input("请输入一个整数:") + +b = input("请再输入一个整数:") + +c = int(a) + int(b) + +print(f'两个数相加,结果是:{c}') + + +import pandas as pd + +pd.read_excel() + + diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/docs/1\343\200\201\345\206\205\345\256\271\345\244\247\347\272\262.xmind" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/docs/1\343\200\201\345\206\205\345\256\271\345\244\247\347\272\262.xmind" new file mode 100644 index 0000000..107ebe8 Binary files /dev/null and "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/docs/1\343\200\201\345\206\205\345\256\271\345\244\247\347\272\262.xmind" differ diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/docs/2\343\200\201\350\275\257\344\273\266\345\256\211\350\243\205.xmind" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/docs/2\343\200\201\350\275\257\344\273\266\345\256\211\350\243\205.xmind" new file mode 100644 index 0000000..10eac4c Binary files /dev/null and "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/docs/2\343\200\201\350\275\257\344\273\266\345\256\211\350\243\205.xmind" differ diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/docs/3\343\200\201\345\237\272\346\234\254\346\225\260\346\215\256\346\223\215\344\275\234.xmind" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/docs/3\343\200\201\345\237\272\346\234\254\346\225\260\346\215\256\346\223\215\344\275\234.xmind" new file mode 100644 index 0000000..c5e5dfa Binary files /dev/null and "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/docs/3\343\200\201\345\237\272\346\234\254\346\225\260\346\215\256\346\223\215\344\275\234.xmind" differ diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/Python\350\203\214\350\256\260\346\211\213\345\206\214.pdf" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/Python\350\203\214\350\256\260\346\211\213\345\206\214.pdf" new file mode 100644 index 0000000..70bf02c Binary files /dev/null and "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/Python\350\203\214\350\256\260\346\211\213\345\206\214.pdf" differ diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/pandas\345\256\230\346\226\271\346\226\207\346\241\243\344\270\255\346\226\207\347\211\210.pdf" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/pandas\345\256\230\346\226\271\346\226\207\346\241\243\344\270\255\346\226\207\347\211\210.pdf" new file mode 100644 index 0000000..eb6de0f Binary files /dev/null and "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/pandas\345\256\230\346\226\271\346\226\207\346\241\243\344\270\255\346\226\207\347\211\210.pdf" differ diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/\346\210\221\347\232\204\345\276\256\344\277\241.jpg" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/\346\210\221\347\232\204\345\276\256\344\277\241.jpg" new file mode 100644 index 0000000..43c8073 Binary files /dev/null and "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/\346\210\221\347\232\204\345\276\256\344\277\241.jpg" differ diff --git "a/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/\350\257\273\350\200\205\347\276\244.jpg" "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/\350\257\273\350\200\205\347\276\244.jpg" new file mode 100644 index 0000000..d608fc1 Binary files /dev/null and "b/3\343\200\201\347\273\231\351\235\236\347\250\213\345\272\217\345\221\230\347\232\204Python\345\205\245\351\227\250\350\257\276\357\274\2140\345\237\272\347\241\200\351\200\202\347\224\250/pdf/\350\257\273\350\200\205\347\276\244.jpg" differ diff --git a/README.md b/README.md index 9687c67..d07a0f5 100644 --- a/README.md +++ b/README.md @@ -1 +1,17 @@ -# awesome-python-framework \ No newline at end of file +# python主流框架的视频教程 + 配套代码 + + + +## 项目介绍 +本项目有以下课程,对应的功能分别是: + + +| 课程 | 视频 | 源码 | +| ---- | -------------- | -------- | +| 1、给小白的《30讲 · Python数据分析》 | https://www.bilibili.com/video/BV17mNDerEcG | [源码](https://github.com/CoderWanFeng/awesome-python-framework/tree/course/1%E3%80%81Python%E8%87%AA%E5%8A%A8%E5%8C%96%E5%8A%9E%E5%85%AC--Pandas%E7%8E%A9%E8%BD%ACExcel%EF%BC%88%E5%85%A830%E9%9B%86%EF%BC%89) | +| 2、Anaconda数据分析&人工智能教程(100讲) | https://www.bilibili.com/video/BV1rU4y1u7og | [源码](https://github.com/CoderWanFeng/awesome-python-framework/tree/course/2%E3%80%81Anaconda%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90%26%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD%E6%95%99%E7%A8%8B%EF%BC%88100%E8%AE%B2%EF%BC%89) | +| 3、给非程序员的Python入门课,0基础适用 | https://www.bilibili.com/video/BV18g411h7jJ | [源码](https://github.com/CoderWanFeng/awesome-python-framework/tree/course/3%E3%80%81%E7%BB%99%E9%9D%9E%E7%A8%8B%E5%BA%8F%E5%91%98%E7%9A%84Python%E5%85%A5%E9%97%A8%E8%AF%BE%EF%BC%8C0%E5%9F%BA%E7%A1%80%E9%80%82%E7%94%A8) | + +## 项目交流群 + +![](https://www.python-office.com/api/img-cdn/group/0816.jpg) diff --git a/celery/app.py b/celery/app.py deleted file mode 100644 index accedf9..0000000 --- a/celery/app.py +++ /dev/null @@ -1,18 +0,0 @@ -# 实例化celery对象 -from celery import Celery -from config import CeleryConfig - -celery_task = Celery('fr_celery') -celery_task.config_from_object(CeleryConfig) - - -@celery_task.task -def task_def(): - print(444) - - - -# 启动命令: -# win11:celery_fr --app=celery_app:celery_task worker -l info -P eventlet -# win10:celery --app=app:celery_task worker --pool=solo --loglevel=info -# linux:sudo /home/admin/.virtualenvs/flexibleRates/bin/celery --app=apps.celery_fr.celery_app:celery_task worker --pool=solo --loglevel=info -E diff --git a/celery/config.py b/celery/config.py deleted file mode 100644 index 08619de..0000000 --- a/celery/config.py +++ /dev/null @@ -1,21 +0,0 @@ -from sqlalchemy import create_engine -from sqlalchemy.orm import sessionmaker - - -class CeleryConfig(): - # timezone = 'UTC' - broker_url = 'redis://:Hx$hfcmsrx3@localhost:6379/4' # 消息队列存放地址 - result_backend = 'redis://:Hx$hfcmsrx3@localhost:6379/5' # celery_fr worker 执行结果返回存放地址 - # BROKER_URL = 'redis://localhost:6379/4' # 消息队列存放地址 - # CELERY_RESULT_BACKEND = 'redis://localhost:6379/5' # celery_fr worker 执行结果返回存放地址 - timezone = 'Asia/Shanghai' # 时区 - task_acks_late = True # 只有当worker执行完任务后,才会告诉MQ,消息被消费。 - CELERYD_FORCE_EXECV = True # 非常重要,有些情况下可以防止死锁 - task_ignore_result = False # 忽略结果,不关心运行结果时可以关闭 - task_serializer = 'json' # 任务序列化方式 - worker_disable_rate_limits = True # 对任务消费的速率进行限制开关 - worker_prefetch_multiplier = 1 # worker预先获取任务数量 - worker_max_tasks_per_child = 30 # worker最大执行任务数,超过数量销毁,防止内存泄漏等问题 - task_create_missing_queues = True # 队列不存在即创建 - broker_transport_options = {'visibility_timeout': 7 * 24 * 60 * 60, 'max_retries': 1} # celery_fr worker超时自动重启时间 - worker_concurrency = 3 # celery_fr worker 最大并行数 diff --git a/celery/main.py b/celery/main.py deleted file mode 100644 index f58f787..0000000 --- a/celery/main.py +++ /dev/null @@ -1,4 +0,0 @@ -from app import task_def - -if __name__ == '__main__': - task_def.delay() \ No newline at end of file diff --git a/flask/__init__.py b/flask/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/flask/apps/__init__.py b/flask/apps/__init__.py deleted file mode 100644 index 68f3f2d..0000000 --- a/flask/apps/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -from flask import Flask - -from .app1.views import api_bp -from ..config import Config - - -def init_app(): - flask_app = Flask(__name__) - flask_app.config.from_object(Config) - flask_app.register_blueprint(api_bp) - return flask_app - -# https://www.cnblogs.com/chaojiyingxiong/p/15058833.html diff --git a/flask/apps/app1/models.py b/flask/apps/app1/models.py deleted file mode 100644 index e69de29..0000000 diff --git a/flask/apps/app1/urls.py b/flask/apps/app1/urls.py deleted file mode 100644 index e69de29..0000000 diff --git a/flask/apps/app1/views.py b/flask/apps/app1/views.py deleted file mode 100644 index 2c9f9e3..0000000 --- a/flask/apps/app1/views.py +++ /dev/null @@ -1,8 +0,0 @@ -from flask import Blueprint - -api_bp = Blueprint("app_orders", __name__) - - -@api_bp.route('/index') -def index(): - return 'index' diff --git a/flask/apps/models.py b/flask/apps/models.py deleted file mode 100644 index e69de29..0000000 diff --git a/flask/apps/urls.py b/flask/apps/urls.py deleted file mode 100644 index e69de29..0000000 diff --git a/flask/apps/views.py b/flask/apps/views.py deleted file mode 100644 index e69de29..0000000 diff --git a/flask/config.py b/flask/config.py deleted file mode 100644 index f671a3a..0000000 --- a/flask/config.py +++ /dev/null @@ -1,4 +0,0 @@ -class Config(): - DEBUG = True - host = "0.0.0.0" - port = int("6001") diff --git a/flask/flask_demo/__init__.py b/flask/flask_demo/__init__.py deleted file mode 100644 index d782e9b..0000000 --- a/flask/flask_demo/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import config \ No newline at end of file diff --git a/flask/flask_demo/apps/__init__.py b/flask/flask_demo/apps/__init__.py deleted file mode 100644 index 818772d..0000000 --- a/flask/flask_demo/apps/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -from flask import Flask - -from .app1.views import api_bp -from config import Config - - -def init_app(): - flask_app = Flask(__name__) - flask_app.config.from_object(Config) - flask_app.register_blueprint(api_bp) - return flask_app - -# https://www.cnblogs.com/chaojiyingxiong/p/15058833.html diff --git a/flask/flask_demo/config.py b/flask/flask_demo/config.py deleted file mode 100644 index aed287d..0000000 --- a/flask/flask_demo/config.py +++ /dev/null @@ -1,4 +0,0 @@ -class Config(): - DEBUG = True - HOST = "0.0.0.0" - PORT = int("6001") diff --git a/flask/flask_demo/manage.py b/flask/flask_demo/manage.py deleted file mode 100644 index a32e8b0..0000000 --- a/flask/flask_demo/manage.py +++ /dev/null @@ -1,9 +0,0 @@ -from flask_script import Manager - -from apps import init_app - -app = init_app() -manage = Manager(app) - -if __name__ == '__main__': - manage.run() diff --git a/flask/manage.py b/flask/manage.py deleted file mode 100644 index b5c6778..0000000 --- a/flask/manage.py +++ /dev/null @@ -1,5 +0,0 @@ -from apps import init_app - -manage = init_app() -if __name__ == '__main__': - manage.run() diff --git a/pandas/insert_column.py b/pandas/insert_column.py deleted file mode 100644 index 9176ddb..0000000 --- a/pandas/insert_column.py +++ /dev/null @@ -1,13 +0,0 @@ -import pandas as pd -import numpy as np - -dates=['April-20', 'April-21', 'April-22', 'April-23','April-24','April-25'] -income=[10,20,10,15,10,12] -expenses=[3,8,4,5,6,10] - -df=pd.DataFrame({"Date":dates, - "Income":income, - "Expenses":expenses}) -df.insert(0, "Empty_1", "") -df.insert(4, "Empty_2", np.nan) -print(df) diff --git a/pandas/read_excel.py b/pandas/read_excel.py deleted file mode 100644 index e69de29..0000000 diff --git a/std-lib/logging.py b/std-lib/logging.py deleted file mode 100644 index e69de29..0000000 diff --git a/std-lib/random.py b/std-lib/random.py deleted file mode 100644 index e69de29..0000000 diff --git a/std-lib/str.py b/std-lib/str.py deleted file mode 100644 index e69de29..0000000