Python Forum
What is the difference between parenthesis and no parenthesis in head and tail?
Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the difference between parenthesis and no parenthesis in head and tail?
#6
(May-14-2017, 01:35 AM)kulimer Wrote: Thank you! It looks like Python still has that address and pointer stuff
This has nothing to do about pointer stuff,that Python don't have.
You can assign to df.columns = that's why it's not a function call.
df.head() is just a function call to get rows,set to default 5.
Eg:
import pandas as pd

df = pd.DataFrame({'a':[1,2,3,4], 'b': [10,20,30,40], 'c': [5,6,7,8], 'd': [50,60,70,80]})
# Set columns,would look bad with ()
df.columns = ['a', 'b', 'c', 'd']
print(df)

a b c d
0 1 10 5 50
1 2 20 6 60
2 3 30 7 70
3 4 40 8 80

# caLL 2 rows
print(df.head(2))

a b c d
0 1 10 5 50
1 2 20 6 60
kulime Wrote:I think in Java you don't get this kind of address problem.
It's not a problem as explained,
Java has it's own bundle of verbose stupidness Wink
Reply


Messages In This Thread
RE: What is the difference between parenthesis and no parenthesis in head and tail? - by snippsat - May-14-2017, 07:04 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  head() d8a988 4 2,686 Sep-03-2020, 09:08 AM
Last Post: buran
  pandas head() not reading all rows naab 0 1,832 Apr-07-2020, 01:06 PM
Last Post: naab

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020