数据基础情况
import numpy as np
import pandas as pd
import matplotlib.pyplot as pyplot
pd.options.display.max_rows = 10
data_url= 'https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-ST0151EN-SkillsNetwork/labs/teachingratings.csv'
data=pd.read_csv(data_url)
data.shape
data.size
data.ndim
len(data)
data.count()
'''
minority 463
age 463
gender 463
credits 463
beauty 463
...
female 463
single_credit 463
upper_division 463
English_speaker 463
tenured_prof 463
Length: 19, dtype: int64
'''
'''
count()函数是一种非常常用的方法,用于统计某个元素在列表、元组或字符串中出现的次数。它的使用非常简单,只需要传入要统计的元素作为参数即可;
基本语法:count(element, start, end);其中,element是要统计的元素;start:(可选,整型)开始的索引,默认0;end :(可选,整型)结束的索引,默认最后一个位置
count()函数返回的是指定元素在列表、元组或字符串中出现的次数。如果元素不存在,则返回0。
1)字符串:string.count( str, start, end )
2)字节串:bytes.count( str, start, end )
3)字节数组:bytearray.count( str, start, end )
4)列表:list.count( element )
5)元组:tuple.count( element )
6)等差数列:range.count( element )
fruits = ['apple', 'banana', 'orange', 'apple', 'grape', 'apple']
count = fruits.count('apple')
print(count)
#>>3
text = "Python is a powerful programming language. Python is widely used in web development, data analysis, and artificial intelligence."
count = text.count('Python')
print(count)
#>>2
numbers = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
count = numbers.count([1, 2])
print(count)
#>>2
'''
data.min()
'''
Rank 1
Title (500) Days of Summer
Genre Action
Description "21" is the fact-based story about six MIT stu...
...
Rating