ValueError: level name Customer Number is not the name of the index
See original GitHub issueFor some reason my transaction_data worked with the first data extraction example, but when I tried the hold out method it failed with the error: ValueError: level name Customer Number is not the name of the index
My ID is ‘customer number’ and this is a text field. For reference, here is the line of code that worked fine summary = summary_data_from_transaction_data(transaction_data, ‘Customer Number’, ‘DAXDate’, observation_period_end=‘2018-01-01’)
Error output:
line 76, in ProcessSalesData
summary_cal_holdout = calibration_and_holdout_data(transaction_data, 'Customer Number', 'DAXDate',calibration_period_end='2017-10-01',observation_period_end='2017-07-01' )
line 91, in calibration_and_holdout_data
.groupby(level=customer_id_col).agg(['count'])
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pandas\core\generic.py", line 6659, in groupby
observed=observed, **kwargs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pandas\core\groupby\groupby.py", line 2152, in groupby
return klass(obj, by, **kwds)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pandas\core\groupby\groupby.py", line 599, in __init__
mutated=self.mutated)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pandas\core\groupby\groupby.py", line 3177, in _get_grouper
'index' % level)
ValueError: level name Customer Number is not the name of the index
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
level name b is not the name of the index - Stack Overflow
Unfortunatly this throws a "ValueError: level name b is not the name of the index" error and I cannot seem to figure out...
Read more >pandas.concat — pandas 1.5.2 documentation
Merge DataFrames by indexes or columns. Notes. The keys, levels, and names arguments are all optional. A walkthrough of how this method fits...
Read more >Performing Groupings on Multi-Index Pandas DataFrames
In my previous article — “Working with Multi-Index Pandas DataFrames”, I talked about how to ... value_name='Temp') # name of new column to...
Read more >KeyError Pandas – How To Fix - Data Independent
Pandas KeyError - This annoying error means that Pandas can not find your column name in your dataframe. Here's how to fix this...
Read more >Understanding the Python Traceback
A traceback is a report containing the function calls made in your code at a specific point. Tracebacks are known by many names,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Problem solved. At least in my case, issue was related to the date value in the observation_period_end parameter. I had a script which imported data between two different dates and I used this “end” date to also define the observation_period_end. However, if the latest timestamp in the data set was less (earlier) than the observation_period_end, I received the error. So in my case, I just didn’t have any data from the time observation period should end. Thank you for your support.
I looked at the source code, and couldn’t understand a way for this to occur. @ariisio if you find a solution or any more evidence, please report back and I’ll merge a fix!