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 :: whitespace delimiter python 
Python :: add new column of dataframe 
Python :: np diag 
Python :: deque in python 
Python :: python and flask create_app 
Python :: cudart64_110.dll not found 
Python :: search method in python 
Python :: Send Axios With Post 
Python :: python function arguments 
Python :: interfaces in python 
Python :: remove element from a list python 
Python :: for loop in django template css 
Python :: python fetch 
Python :: sample 
Python :: print column name and index python 
Python :: sys.argv python example 
Python :: how to console log in django heroku 
Python :: myshop flower notimplementederror 
Python :: quadrilateral 
Python :: metodo estatico de python 
Python :: python - notification messages 
Python :: b-spline quantile regression with statsmodels 
Python :: django query multiple 
Python :: python deep setter 
Python :: useful functions in python 
Python :: Filter dataarray 
Python :: calculate time between datetime pyspark 
Python :: `nlp.add_pipe` now takes the string name of the registered component factory 
Python :: tkinter label abstand nach oben 
Python :: How to get the positions where values of two columns match? 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =