Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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

what is .iloc[:, 1:2].values

>>> 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

iloc[:,0:-1]

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

PREVIOUS NEXT
Code Example
Python :: python 2d matrix declare 
Python :: hash table data structure python 
Python :: dictionary get all values 
Python :: Python NumPy expand_dims Function Syntax 
Python :: python string after character 
Python :: how to use python all() function to check a list is empty or not 
Python :: or in if statement python 
Python :: sum python 
Python :: linear search in c++ 
Python :: python string: .title() 
Python :: get sum of 2d array python 
Python :: range 
Python :: python all 
Python :: how do variables work in python 
Python :: import from parent directory in python setup 
Python :: manual merge sort 
Python :: print column name and index python 
Python :: np.random.rand() 
Python :: bar break matplotlib 
Python :: python list of deeper paths 
Python :: python change font in 1 line 
Python :: codegrepper is cool 
Python :: convert only time to unix timestamp python 
Python :: how to add the number to email address in faker library in python? 
Python :: pandascheck if two columns match and populate new column 
Python :: snap python api 
Python :: refresh tab selenium python 
Python :: python monats liste 
Python :: subprocess open txt file python 
Python :: &lt;function chr(i, /)&gt; error in python 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =