Manipulating Data Frames in Python
Manipulating Data Frames in Python, in this article i will show you how to manipulate imported data frames into python
- Deleting Column
- Deleting bunch of Column
- Deleting Row
- Deleting bunch of Row
- Adding Column
- Tran-pose Data Frame
- Adding a new Row
Deleting Column
- df1.drop(“City”,1)
Deleting Bunch of Column
- df1.drop(df1.columns[0:3],1)
Deleting Rows
- df1.drop(98797,0)
Deleting Bunch Rows
- df1.drop(df1.set_index[0:3],0)
Adding Columns
- df1[“Salary”]=df1.shape[0]*[“$5000”]
Tran-pose Data Frame
- df1.T
- This will turn row into column , and column into row
Adding Row
- Before Adding Row , first you will need to trans-pose the Data Set
- Then Just like Adding the Column Data, input which ever data you want it to be resided in the Columns
- Trans-pose the Data Frame again
Check out slicing and indexing DataFrame here