-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathproblam_pandas.py
34 lines (27 loc) · 1.07 KB
/
problam_pandas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pandas as pd # Import the pandas library for data manipulation
# Read the CSV file into a DataFrame
output = pd.read_csv('datas.csv')
# Initialize column and row boundaries
col_strat = 0
col_end = 5
row_start = 0
row_end = 10
# Loop through the DataFrame in chunks of 10 rows
for _ in range((len(output.axes[0]) + 1) // 10):
# Loop through the DataFrame in chunks of 5 columns
for _ in range((len(output.columns)) // 5):
# Create a new DataFrame for the specified row and column slice
df = pd.DataFrame(output.iloc[row_start:row_end, col_strat:col_end])
# Print the DataFrame as a string
print(df.to_string())
# Update column boundaries for the next chunk
col_strat += 5
col_end += 5
# Reset column boundaries for the next set of rows
col_strat = 0
col_end = 5
# Update row boundaries for the next chunk of rows
row_start += 10
row_end += 10
# Print a separator line for clarity
print('<=============================================>\n<=============================================>')