Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle strange Pandas error "unable to open hashtable..."

Pandas seems to be calling something I am not asking it to call.. I do not really know. This was working before I re-installed anaconda but now it is not. I reinstalled because my numpy build keeps failing once I close visual studio code (yes I have updated both numpy and pandas)

I am trying to practice cleaning up data. I have already tried re-installing and more. I have tried resetting the index, I have tried ensuring everything sets up as a dataframe but nothing seems to work.

I will try to include a photo of the error but it opens "unable to open 'hashtable_class_helper.pxi': File not found (file:///c:/users/chris/documents/python scripts/pandas/_libs/hashtable_class_helper.pxi)." and asks me to create the file. I am only trying to set the index so that I can work with my data.

my pythonpath is "C:\Users\Chris\Anaconda3\python.exe" my envionmental path is ;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Users\Chris\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\bin\git.exe;C:\Users\Chris\Anaconda3\python.exe"

import numpy as np
import matplotlib.pyplot as plt 
import pandas as pd 

df = pd.read_csv(r'C:\Users\Chris\Documents\PythonExcel\tb.csv')
dfcases = df[['m04','m514','m014','m1524','m2534','m3544','m4554','m5564','m65','mu','f04','f514','f014','f1524','f2534','f3544','f4554','f5564','f65','fu']].dropna(how='all').fillna(0)
dfcases.set_index('id', inplace=True)
print(dfcases.head())

I should expect to see the index labeled as "id" When I remove the set_index function, it prints the dataframe w/ an index but the index is not labeled

a screenshot of the error

like image 989
Christopher Munson Avatar asked Feb 06 '19 18:02

Christopher Munson


People also ask

What is pandas errors parsererror?

In today’s short guide, we discussed a few cases where pandas.errors.ParserError: Error tokenizing data is raised by the pandas parser when reading csv files into pandas DataFrames. Additionally, we showcased how to deal with the error by fixing the errors or typos in the data file itself, or by specifying the appropriate line terminator.

What does “no module named Pandas” mean?

The error “No module named pandas ” will occur when there is no pandas library in your environment IE the pandas module is either not installed or there is an issue while downloading the module right. Let’s see the error by creating an pandas dataframe. We will discuss how to overcome this error.

Where can I find the pandas description in Python?

Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (1.1.5) To get the pandas description in our environment we can use the show command. This can help keep track of the module and its installation. Summary: Powerful data structures for data analysis, time series, and statistics


1 Answers

Your case seems a little than mine, but I had the same popup error come up and I read that it had to do with a keyerror with pandas dataframe. It turned out I was trying to access a dataframe column but lowercase instead of capitalized, so it was looking for a column name that didn't exist. I corrected this and the error went away

So, if anyone else gets this issue, check your strings and variable names, syntax, look for keyerrors, use try / except around the issue and print the error

like image 91
Jacob Evens Avatar answered Sep 29 '22 15:09

Jacob Evens