title: Python ValueError: Duplicated level name: "REPORTED_DATE", assigned to level 1, is already used for level 0
body: <p>i am trying to group by dataframe based on weekday and year from its datetime column.</p>
  
  <p>my data looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/PGaVl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PGaVl.png" alt="enter image description here"></a></p>
  
  <p>and here is very sample code:</p>
  
  <pre><code>#Measuring crime by weekday and year
  import pandas as pd
  import matplotlib.pyplot as plt
  crime=pd.read_hdf('data/crime.h5','crime')
  crime.head()
  
  #Group by both weekday and year
  weekday_name=crime['REPORTED_DATE'].dt.weekday_name
  year=crime['REPORTED_DATE'].dt.year
  
  crime_wd_y=crime.groupby([year,weekday]).size()
  crime_wd_y
  </code></pre>
  
  <p>But I got the error:</p>
  
  <blockquote>
    <p>ValueError: 
    Duplicated level name: "REPORTED_DATE", assigned to level
    1, is already used for level 0.</p>
  </blockquote>
  
  <p>Can anyone explain what does that mean? I am new to Python, I did some google searches, but still very confused.</p>