Hospital sales data analysis Case key knowledge points
Read
data = pd.read_excel('chao.xlsx',dtype='object')
To prevent the data types, object type introduced with the first unified
Back to the column name
dataDF.rename (Columns = { "consumers in Time": "sales period"}, InPlace = True)
Data type conversion
dataDF [ "sales"] = dataDF [ "sales"] .astype ( "F8")
f8 here is the meaning of float64
Time Format String turn, strong turn error
dataDF.loc [:, "sales period"] = pd.to_datetime (dataDF.loc [:, "sales period"], errors = 'coerce')
Number of days based on the time
daysI = (endTime - startTime).days
Business Index
The average monthly consumption = total number of times the consumption / number of months
The average monthly amount of consumption = total consumption amount / number of months
Customer price = total amount of consumption / number of total consumption
Consumer trends
Common drawing property settings
Prevent Chinese error when drawing
-
from pylab import mplmpl.rcParams [ 'font.sans-serif'] = [ 'SimHei']