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 :: drop duplicates data frame pandas python 
Python :: flask delete from database 
Python :: split column values 
Python :: roc auc score 
Python :: python read from stdin pipe 
Python :: python serialize 
Python :: list to text python 
Python :: python save plot 
Python :: python googledriver download 
Python :: how to find missing item in a list 
Python :: Python Tkinter TopLevel Widget 
Python :: regular expression syntax python 
Python :: discard python 
Python :: print only strings in list python 
Python :: pandas to csv 
Python :: éliminer le background image python 
Python :: Chudnovsky algorithm in python codes 
Python :: python remove item from a list 
Python :: for in list start with index python 
Python :: how to make colab reload on form change 
Python :: add output to setting scrapy 
Python :: how to append dict to dict in python 
Python :: how to list gym envirolments 
Python :: set index values pandas 
Python :: how to get a list of files in a folder in python with pathlib 
Python :: plotly ylog 
Python :: how to install pandas for aws sam local 
Python :: how to get max value and min values in entire dataframe 
Python :: pandas series create 
Python :: generate a random np image array with shape 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =