mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
(cherry picked from commit 9e9ca85bb307c9fb784998bc49732b6c2674158b) GitOrigin-RevId: 9ed3bae6c8776f6be4e504b297e7c0e838420eaa
35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
import pandas as pd
|
|
import numpy as np
|
|
df1 = pd.DataFrame({'row': [0, 1, 2],
|
|
'One_X': [1.1, 1.1, 1.1],
|
|
'One_Y': [1.2, 1.2, 1.2],
|
|
'Two_X': [1.11, 1.11, 1.11],
|
|
'Two_Y': [1.22, 1.22, 1.22]})
|
|
print(df1) ###line 8
|
|
|
|
df2 = pd.DataFrame({'row': [0, 1, 2],
|
|
'One_X': [1.1, 1.1, 1.1],
|
|
'One_Y': [1.2, 1.2, 1.2],
|
|
'Two_X': [1.11, 1.11, 1.11],
|
|
'Two_Y': [1.22, 1.22, 1.22],
|
|
'LABELS': ['A', 'B', 'C']})
|
|
print(df2) ##line 16
|
|
|
|
df3 = pd.DataFrame(data={'Province' : ['ON','QC','BC','AL','AL','MN','ON'],
|
|
'City' : ['Toronto','Montreal','Vancouver','Calgary','Edmonton','Winnipeg','Windsor'],
|
|
'Sales' : [13,6,16,8,4,3,1]})
|
|
table = pd.pivot_table(df3,values=['Sales'],index=['Province'],columns=['City'],aggfunc=np.sum,margins=True)
|
|
table.stack('City')
|
|
print(df3)
|
|
|
|
df4 = pd.DataFrame({'row': np.random.random(10000),
|
|
'One_X': np.random.random(10000),
|
|
'One_Y': np.random.random(10000),
|
|
'Two_X': np.random.random(10000),
|
|
'Two_Y': np.random.random(10000),
|
|
'LABELS': ['A'] * 10000})
|
|
print(df4) ##line 31
|
|
|
|
df5 = pd.DataFrame({'foo_%': np.random.random(10)})
|
|
print(df5) #line 34
|