import pandas as pd
df = pd.DataFrame([
[1,2,3],
[4,5,6],
[7,8,9]
])
#print(df)
df = pd.read_csv(‘C:\work\python\excel\z210815_data.csv’, header = 2)
#print(df)
print(df.head(3))
#print(df.tail())
df2 = pd.read_excel(‘C:\work\python\excel\z210815_data.xlsx’, header = 2)
print(df2.head(3))
df3 = pd.read_excel(‘C:\work\python\excel\z210815_data.xlsx’, header = 2, sheet_name=’s2′)
print(df3.head(3))
print(df3[“value”])
print(df3[[“value”]])
print(df3[[“y”, “value”]])
print(df3.iloc[:,0:4])
print(df3.iloc[:,:-1])
print(df3[df3[‘value’] > 23]) #valueが24以上を表示
print(df3.sort_values(by = ‘value’).head())
print(df3.mean())
print(df3.std())
print(df3.describe())
|