GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — machinelearning-python/pd-dataframe.py at master · wwdaigo/machinelearning-python

Expand file tree

/

pd-dataframe.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
53 lines (48 loc) · 1.3 KB
/

pd-dataframe.py

Copy path

File metadata and controls

53 lines (48 loc) · 1.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import pandas as pd
d = {
'name': pd.Series(['Braund', 'Cummings', 'Heikkinen', 'Allen'], index = ['a', 'b', 'c', 'd']),
'age': pd.Series([22,38,26,35], index = ['a', 'b', 'c', 'd']),
'fare': pd.Series([7.25,71.83,8.05], index = ['a', 'b', 'd']),
'survived?': pd.Series([False, True, True, False], index = ['a', 'b', 'c', 'd'])
}
df = pd.DataFrame(d)
#print df
'''
age fare name survived?
a 22 7.25 Braund False
b 38 71.83 Cummings True
c 26 NaN Heikkinen True
d 35 8.05 Allen False
'''
cuteness = pd.Series([1, 2, 3, 4, 5], index=['Cockroach', 'Fish', 'Mini Pig', 'Puppy', 'Kitten'])
#print cuteness > 3
'''
Cockroach False
Fish False
Mini Pig False
Puppy True
Kitten True
dtype: bool
'''
#print cuteness[cuteness > 3]
'''
Puppy 4
Kitten 5
dtype: int64
'''
series = pd.Series(['Dave', 'Cheng-Han', 359, 9001],
index=['Instructor', 'Curriculum Manager','Course Number', 'Power Level'])
'''
Instructor Dave
Curriculum Manager Cheng-Han
Course Number 359
Power Level 9001
'''
print series['Instructor']
#Dave
print series[['Instructor', 'Curriculum Manager', 'Course Number']]
'''
Instructor Dave
Curriculum Manager Cheng-Han
Course Number 359
'''
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.