This commit is contained in:
4448445@qq.com 2022-03-26 17:48:58 +08:00
parent 96201641f1
commit 4b3ba482ca
14 changed files with 105 additions and 1 deletions

2
.gitignore vendored
View File

@ -5,7 +5,7 @@ __pycache__/
# C extensions
*.so
/.idea/
# Distribution / packaging
.Python
build/

2
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Default ignored files
/workspace.xml

21
.idea/deployment.xml Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData">
<serverData>
<paths name="pi@192.168.199.217:22">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
<paths name="pi@192.168.199.217:22 (1)">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (venv) (2)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pythonbook.iml" filepath="$PROJECT_DIR$/.idea/pythonbook.iml" />
</modules>
</component>
</project>

8
.idea/pythonbook.iml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,17 @@
import pandas as pd
df = pd.read_csv('..\data\learn_pandas.csv')
df_demo = df[['Height', 'Weight']]
print(df_demo.mean(),df_demo.max(),df_demo.quantile(0.75))
# 此外,需要介绍的是 quantile, count, idxmax 这三个函数,它们分别返回的是
# 分位数、
# 非缺失值个数、
# 最大值对应的索引
print(df_demo.mean(axis=1).head())
df_demo = df[['Gender','Transfer','Name']]
print(df_demo.drop_duplicates(['Gender', 'Transfer']))

View File

@ -0,0 +1,8 @@
import pandas as pd
df = pd.read_csv('..\data\learn_pandas.csv')
df_demo = df[['Grade', 'Name', 'Height','Weight']].set_index(['Grade','Name'])
a1 = df_demo.sort_values('Height').head()
print(a1)

View File

@ -0,0 +1,6 @@
import pandas as pd
s = pd.Series([-1, 1.2345, 100, -50])
print(s.where(s<0, 100))

View File

@ -0,0 +1,8 @@
import pandas as pd
df = pd.read_csv('..\data\learn_pandas.csv')
df_demo = df[['Grade', 'Name', 'Height','Weight']].set_index(['Grade','Name'])
a1 = df_demo.apply(lambda x:(x-x.mean()).abs().mean())
print(a1)

View File

@ -0,0 +1,7 @@
import pandas as pd
s = pd.Series([1,2,3,4,5])
roller = s.rolling(window = 3)
print(roller)
print(s.shift(1))

Binary file not shown.