Comments (6)
Hi.
Just back from some time off. Looks like we have to do some rewriting for Python 3.9??
from django-pandas.
This also occurred on Python 3.7
from django-pandas.
And 3.8.:
[ 40s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-django-pandas-0.6.2-0.x86_64/usr/lib/python3.8/site-packages
[ 40s] + python3.8 runtests.py
[ 41s] /home/abuild/rpmbuild/BUILD/django-pandas-0.6.2/django_pandas/tests/test_manager.py:10: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.
[ 41s] import pandas.util.testing as tm
[ 41s] Creating test database for alias 'default'...
[ 41s] System check identified some issues:
[ 41s]
[ 41s] WARNINGS:
[ 41s] tests.Car: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.DataFrame: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.Dude: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.LongTimeSeries: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.MyModel: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.MyModelChoice: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.PivotData: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.Portfolio: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.Security: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.Spot: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.TradeLog: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.TradeLogNote: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.Trader: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.WideTimeSeries: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s] tests.WideTimeSeriesDateField: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
[ 41s] HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
[ 41s]
[ 41s] System check identified 15 issues (0 silenced).
[ 41s] ........E...........
[ 41s] ======================================================================
[ 41s] ERROR: test_verbose (django_pandas.tests.test_io.RelatedFieldsTest)
[ 41s] ----------------------------------------------------------------------
[ 41s] Traceback (most recent call last):
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/fields/__init__.py", line 1823, in get_prep_value
[ 41s] return int(value)
[ 41s] ValueError: cannot convert float NaN to integer
[ 41s]
[ 41s] The above exception was the direct cause of the following exception:
[ 41s]
[ 41s] Traceback (most recent call last):
[ 41s] File "/home/abuild/rpmbuild/BUILD/django-pandas-0.6.2/django_pandas/tests/test_io.py", line 143, in test_verbose
[ 41s] df = read_frame(qs, verbose=True)
[ 41s] File "/home/abuild/rpmbuild/BUILD/django-pandas-0.6.2/django_pandas/io.py", line 128, in read_frame
[ 41s] update_with_verbose(df, fieldnames, fields)
[ 41s] File "/home/abuild/rpmbuild/BUILD/django-pandas-0.6.2/django_pandas/utils.py", line 83, in update_with_verbose
[ 41s] df[fieldname] = function(df[fieldname])
[ 41s] File "/home/abuild/rpmbuild/BUILD/django-pandas-0.6.2/django_pandas/utils.py", line 57, in inner
[ 41s] for obj in model.objects.filter(
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
[ 41s] return getattr(self.get_queryset(), name)(*args, **kwargs)
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/query.py", line 941, in filter
[ 41s] return self._filter_or_exclude(False, args, kwargs)
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/query.py", line 961, in _filter_or_exclude
[ 41s] clone._filter_or_exclude_inplace(negate, args, kwargs)
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/query.py", line 968, in _filter_or_exclude_inplace
[ 41s] self._query.add_q(Q(*args, **kwargs))
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1393, in add_q
[ 41s] clause, _ = self._add_q(q_object, self.used_aliases)
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1412, in _add_q
[ 41s] child_clause, needed_inner = self.build_filter(
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1347, in build_filter
[ 41s] condition = self.build_lookup(lookups, col, value)
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1193, in build_lookup
[ 41s] lookup = lookup_class(lhs, rhs)
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/lookups.py", line 25, in __init__
[ 41s] self.rhs = self.get_prep_lookup()
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/lookups.py", line 240, in get_prep_lookup
[ 41s] rhs_value = self.lhs.output_field.get_prep_value(rhs_value)
[ 41s] File "/usr/lib/python3.8/site-packages/django/db/models/fields/__init__.py", line 1825, in get_prep_value
[ 41s] raise e.__class__(
[ 41s] ValueError: Field 'id' expected a number but got nan.
[ 41s]
[ 41s] ----------------------------------------------------------------------
[ 41s] Ran 20 tests in 0.502s
[ 41s]
[ 41s] FAILED (errors=1)
from django-pandas.
Hi. Just back from some time off. Looks like we have to do some rewriting for Python 3.9??
hello it looks like this on just a newer version of pandas:
on Python3.6 (pandas 1.1.5):
(Pdb) import pandas
(Pdb) pandas
<module 'pandas' from '/home/graingert/projects/django-pandas/.tox/py3.6-django32/lib/python3.6/site-packages/pandas/__init__.py'>
(Pdb) pandas.__version__
'1.1.5'
-> pk_series = pk_series.where(pk_series.notnull(), None)
(Pdb) pk_series
0 NaN
1 NaN
2 1.0
3 1.0
4 2.0
5 2.0
6 2.0
7 2.0
Name: symbol, dtype: float64
(Pdb) pk_series.where(pk_series.notnull(), None)
0 None
1 None
2 1
3 1
4 2
5 2
6 2
7 2
Name: symbol, dtype: object
however on pandas 1.3.3 and python 3.9.7 you get:
Python 3.9.7 (default, Sep 9 2021, 23:20:13)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>> pk_series = pandas.read_csv(io.StringIO(',symbol\n0,\n1,\n2,1.0\n3,1.0\n4,2.0\n5,2.0\n6,2.0\n7,2.0\n')).symbol
>>> pk_series
0 NaN
1 NaN
2 1.0
3 1.0
4 2.0
5 2.0
6 2.0
7 2.0
Name: symbol, dtype: float64
>>> pk_series.notnull()
0 False
1 False
2 True
3 True
4 True
5 True
6 True
7 True
Name: symbol, dtype: bool
>>> pk_series.where(pk_series.notnull(), None)
0 NaN
1 NaN
2 1.0
3 1.0
4 2.0
5 2.0
6 2.0
7 2.0
Name: symbol, dtype: float64
>>> pandas.__version__
'1.3.3'
from django-pandas.
pandas 1.2.5 has the old behaviour
from django-pandas.
from django-pandas.
Related Issues (20)
- verbose does not return Foreign Key object's name
- Cannot extend admin-tools blocks into new templates HOT 1
- Django 3.1: AttributeError: module 'django.db.models.fields' has no attribute 'FieldDoesNotExist' with annotation HOT 3
- Safely saving pandas DataFrame to SQL table via Django HOT 5
- read_frame bug: ForeignKey lookup fails if any Null values present HOT 2
- Possible to release latest dev version to PyPI? HOT 8
- Bug: `read_frame` does not work if at least one manager is not named "objects"
- How can I merge different tables on the basis of a foreign key?
- error if primary_key is not int() HOT 6
- Converting django.models.DateField to datetime64 in read_frame
- Race condition of queryset in read_frame HOT 3
- configure github actions (travis tests are no longer running) HOT 4
- run tests with warnings enabled HOT 1
- Stack Trace - ValueError: cannot convert float NaN to integer - When a foreign key is null HOT 4
- force_text removed in Django 4.0 HOT 2
- Bug with binary field and to_pivot_table HOT 2
- Data truncation
- read_frame breaks if fieldnames and column_names are passed and there is an FK reference in the fieldnames
- Pandas 2.1 has a deprecation warning for convert_dtype on read_frame HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-pandas.