'Plotting multiple figures from one excel file using pandas and matplotlib
I am working with a rather large excel file (over million rows). I want to plot 720 rows and then skip 43609 rows and then plot the next 720 to a different figure. Is there a way to do this without having to read the file before every plot and still be able to use skiprows?
Solution 1:[1]
Possible solution is to use lambda function in skiprows parameter of pd.read_excel and the slices to create plots from required rows.
For example you would like to skip yellow rows in the excel file that looks like:
# pip install pandas
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_excel('data.xlsx', header=0, skiprows = lambda x: x in range(6, 11))
df
Then you can use slices to create plots.
plt.plot(df[:4])
plt.plot(df[5:])
plt.show()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |



