I have the following dataframe: <class 'pandas.core.frame.DataFrame'>
RangeIndex: 1642 entries, 0 to 1641
Data columns (total 13 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Date 1642 non-null datetime64[ns]
1 Volgnr 1642 non-null int64
2 account 1642 non-null object
3 Rentedatum 1642 non-null datetime64[ns]
4 Bedrag 1642 non-null float64
5 Balance 1642 non-null float64
6 tegenrekening 906 non-null object
7 Code 1642 non-null object
8 Naam tegenpartij 1642 non-null object
9 description 1642 non-null object
10 category 1642 non-null object
11 Grootboek 1578 non-null object
12 Kleinboek 1578 non-null object
dtypes: datetime64[ns](2), float64(2), int64(1), object(8)
memory usage: 166.9+ KB
'account' has 5 different account numbers which like so: NL00ABCD0123456789
I want two different graphs but I'm already stuck with the first one i.e. I want to see the balance over time for the 5 accounts
In line with other question on this forum I tried:
pd.options.plotting.backend="plotly"
df.set_index('Date', inplace=True)
df.groupby('account')['balance'].plot(legend=True)
But got the following error:
TypeError: line() got an unexpected keyword argument 'legend'
What is going wrong here?
For later: If that is solved I want the X-axis to be weeks or months instead of the absolute date so some aggregation will be necessary
source https://stackoverflow.com/questions/70723457/pandas-plot-multiple-lines-against-date
Comments
Post a Comment