I am trying to run a python program on a raspberry pi. The program uses the pandas library including the 'json_normalize' function. I have tried importing pandas with import pandas, and from pandas.io.json import json_normalize but I still get the error. I am using pandas version 0.23.3. Is it just a version problem or is there something else?
There is a problem with Pandas 0.23.
but, You still can run it with pandas 0.22
check this issue open for this problem
Related
Does anyone know the fix for this "pd is not defined"? it seems to be combined with a dying kernel. I'm using Jupyter Notebook.
I had started with these imports and didn't get an error message so I was assuming that pandas was imported successfully
import pandas as pd
import numpy as np
Tried updating my Python version to 3.11
This should not be a python problem. Since import pandas as pd did not fail, you should try print out print(pd) and see where pandas is installed and maybe verify it is is properly installed. It should print out something like lib/python3.x/site-packages/pandas/__init__.py'.
I am using Jupyter Notebook with python 3.8.
I get an error:
ImportError: cannot import name 'datetools' from 'pandas'
from the code below:
import pandas as pd
from pandas import datetools
I confirm that pandas is installed but I saw that datetools is deprecated.
What can I do to solve this problem?
Pandas datetools may have been removed from the version you are using now in your system.
Try downgrading the pandas if you insist on using datetools, or for better solution, use datetime package that will help you achieve results.
I have a problem using Atom in Ubuntu 16.04 for some Python code I'm working at. I have already installed Script. Every time I try to import pandas as pd the command works, but only takes pandas as name, instead of pd.
Importing data with: pd.read_csv( ... ) thus gives me the following error: NameError: name 'pd' is not defined.
In other editors (such as Spyder) I don't have any problem.
What can I do to fix this?
I'm trying to use pandas 0.22, due mainly to 0.23.x's problems with pd.to_sql as specified here, on Windows 7. When I run
import pandas as pd
I get
AttributeError: module 'pandas._libs.lib' has no attribute 'isscalar'
From
inference.py, line 20
In fact, when I upgrade pandas to 0.23.4 (the latest version at the time of writing) I get the same problem, one which didn't exist before I tried to downgrade.
If I edit pandas.cor.dtypes.inference and set is_scalar to be True, I get another error:
ImportError: cannot import name 'Timestamp'
I haven't found anywhere else online which seems to solve this.
Thanks!
SOLVED
I navigated to the pandas location in my hard drive and removed the folder manually. I imagine that my installation had been messed up and it wasn't reinstalling properly. Just deleted, and reinstalled from cmd.
Please note, this is not a duplicate question. I'm aware of how to find versions of libraries in python. What's caught my goat is the apparent anomaly when the __version__ command is called in two different ways.
Has anyone faced this before? When I type the following in IDLE, I get the output which specifies the pandas version.
>>>import pandas as pd
>>>print(pd.__version__)
0.22.0
When I put the same two lines of code into a program, save it and run it, I get the following error:
AttributeError: module 'pandas' has no attribute '__version__'
It does not make any sense to me. Appreciate any thoughts on this please.
It sounds like you're not importing the real pandas module when you run your script from a file. When I run your script in a file on my machine it prints the pandas version correctly.
Maybe you have a file called pandas.py or a directory called pandas in your current working directory when you run the script? Or maybe there is a pandas.py or a pandas directory in a directory in your PYTHONPATH environment variable? (Other than the real pandas, that is.) Try running this program and see if the output looks like the proper pandas source file, or something else.
import pandas as pd
print(pd.__file__)