Here is still to recommend my own built Python development Learning Group: 483546416, the group is the development of Python, if you are learning Python, small series welcome you to join, everyone is the software Development Party, not regularly share dry goods (only Python software development-related), Including a copy of my own 2018 of the latest Python advanced materials and high-level development tutorials, welcome to the next step and into the small partners who want to dive into python.
And also Big Data Learning Group: 784557197
Practical Practice
Execute the following code on the Jupyter notebook:
import pandas as pddf = pd.DataFrame({‘col1‘:[1,2,3,4],‘col2‘:[444,555,666,444],‘col3‘:[‘abc‘,‘def‘,‘ghi‘,‘xyz‘]})df.head()
Get Unique values
df[‘col2‘].unique()
Get non-unique values
df[‘col2‘].nunique()
Get the number of each value
df[‘col2‘].value_counts()newdf = df[(df[‘col1‘]>2) & (df[‘col2‘]==444)]newdf
Application function
def times2(x):return x*2df[‘col1‘].apply(times2)
df[‘col2‘].apply(lambda x:x*2)
df[‘col3‘].apply(len)
df[‘col1‘].sum()
Permanently delete a column
del df[‘col1‘]df
df = pd.DataFrame({‘col1‘:[1,2,3,4],‘col2‘:[444,555,666,444],‘col3‘:[‘abc‘,‘def‘,‘ghi‘,‘xyz‘]})df.drop(‘col1‘,axis=1,inplace=True)df
0 Basics to Mastery: Python Big Data and machine learning pandas-data manipulation