Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

df iloc

df.iloc[[0, 2], [1, 3]]
      b     d
0     2     4
2  2000  4000
Comment

pd df iloc

df.iloc[:3]
      a     b     c     d
0     1     2     3     4
1   100   200   300   400
2  1000  2000  3000  4000
Comment

iloc pandas

mydict = [{'a': 1, 'b': 2, 'c': 3, 'd': 4},
...           {'a': 100, 'b': 200, 'c': 300, 'd': 400},
...           {'a': 1000, 'b': 2000, 'c': 3000, 'd': 4000 }]
>>> df = pd.DataFrame(mydict)
>>> df
      a     b     c     d
0     1     2     3     4
1   100   200   300   400
2  1000  2000  3000  4000

>>>type(df.iloc[0])
<class 'pandas.core.series.Series'>
>>>df.iloc[0]
a    1
b    2
c    3
d    4
Name: 0, dtype: int64
Comment

df iloc

df.iloc[[0]]
   a  b  c  d
0  1  2  3  4
>>> type(df.iloc[[0]])
<class 'pandas.core.frame.DataFrame'>
Comment

return df.iloc[1:]

>>> df.iloc[1:3, 0:3]
      a     b     c
1   100   200   300
2  1000  2000  3000
Comment

pandas df iloc

df.iloc[0, 1]
2
Comment

pandas df iloc

df.iloc[[0, 1]]
     a    b    c    d
0    1    2    3    4
1  100  200  300  400
Comment

PREVIOUS NEXT
Code Example
Python :: find each geometry overlap python 
Python :: how to leave a function python 
Python :: Get text without inner tags text in selenium 
Python :: split list python percent 
Python :: pygame template 
Python :: aiohttp 
Python :: Python remove duplicate lines from a text file 
Python :: python if string has spaces 
Python :: python docker 
Python :: Maximize Difference 
Python :: python list include 
Python :: clipboard python 
Python :: new paragraph python 
Python :: python collections to dictionary 
Python :: python how to iterate through a list of lists 
Python :: best way to access nested key in python 
Python :: how to print a value of a key in nested dictionary python 
Python :: seaborn countplot hue stacked 
Python :: * pattern by python 
Python :: assert with message python 
Python :: pandas sum group by 
Python :: image processing python 
Python :: how to take n space separated input in python” Code Answer’s 
Python :: keras load model with custom objects 
Python :: pass variable to thread target 
Python :: pandas set hour for timestamp 
Python :: count occurrences of one variable grouped by another python 
Python :: created by and updated by in django 
Python :: looping over lists in python 
Python :: Removing Elements from Python Dictionary Using clear() method 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =