Slice pandas DataFrame by Index in Python (Example) | Split at Particular Row | How to Divide Data

Veröffentlicht am: 06 Juli 2022
auf dem Kanal: Statistics Globe
2,410
20

How to split a pandas DataFrame at a certain row index position in the Python programming language. More details: https://statisticsglobe.com/slice-pan...
Python code of this video:

import pandas as pd # Load pandas

data = pd.DataFrame({'x1':range(10, 18), # Create pandas DataFrame
'x2':['a', 'b', 'b', 'c', 'd', 'a', 'b', 'd'],
'x3':range(27, 19, - 1),
'x4':['x', 'z', 'y', 'y', 'x', 'y', 'z', 'x']})
print(data) # Print pandas DataFrame

split_point = 3 # Define split point
print(split_point) # Print split point
3

data_upper = data.iloc[:split_point] # Create upper data set
print(data_upper) # Print DataFrame of upper rows

data_lower = data.iloc[split_point:] # Create lower data set
print(data_lower) # Print DataFrame of lower rows

Follow me on Social Media:
Facebook – Statistics Globe Page:   / statisticsglobecom  
Facebook – R Programming Group for Discussions & Questions:   / statisticsglobe  
Facebook – Python Programming Group for Discussions & Questions:   / statisticsglobepython  
LinkedIn – Statistics Globe Page:   / statisticsglobe  
LinkedIn – R Programming Group for Discussions & Questions:   / 12555223  
LinkedIn – Python Programming Group for Discussions & Questions:   / 12673534  
Twitter:   / joachimschork  

Music by bensound.com


Auf dieser Seite können Sie das Online-Video Slice pandas DataFrame by Index in Python (Example) | Split at Particular Row | How to Divide Data mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Statistics Globe 06 Juli 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 2,410 Mal angesehen und es wurde von 20 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!