Coder Social home page Coder Social logo

error if primary_key is not int() about django-pandas HOT 6 OPEN

tlk3 avatar tlk3 commented on August 15, 2024 3
error if primary_key is not int()

from django-pandas.

Comments (6)

abdeltif-b avatar abdeltif-b commented on August 15, 2024

I have the same issue when the foreign-key in a model is a string. Any workaround for this?

from django-pandas.

bartpijn avatar bartpijn commented on August 15, 2024

I worked around it by specifying the cols.

from django-pandas.

krishnakafle avatar krishnakafle commented on August 15, 2024

I have face similar issue

invalid literal for int() with base 10: 'bk-dw-02'

Specifying of columns doesn't help me either.

qs = GwMonitoringKobo.objects.all()
df = read_frame(qs, fieldnames=['date', 'district', 'latitude','longitude','altitude','precision','well_type','measurement_point_cm', 'measurement_of_wet_point_on_tape_in_m_field',
                 'gw_level_from_mp','mp_in_m','gw_level', 'fid','well_num'])

from django-pandas.

sundyloveme avatar sundyloveme commented on August 15, 2024

why I am ok??
I am configuration:
Django 2.2
numpy 1.21.5
pandas 1.3.5
pip 21.1.2
python-dateutil 2.8.2
pytz 2021.3
semver 2.13.0
setuptools 57.0.0
six 1.16.0
sqlparse 0.4.2
wheel 0.36.2

image

from django-pandas.

TheAbhilash23 avatar TheAbhilash23 commented on August 15, 2024

Can you tell why you have set your entity relationship as

class Testing1(models.Model):
symbol = models.CharField('Ticker', max_length=32, primary_key=True)
tf = models.CharField('timeframe', max_length=1)

class Testing2(models.Model):
symbol = models.ForeignKey(Testing1, on_delete=models.CASCADE)
price = models.CharField('price', max_length=1)

When I setup the models I use Model Class as Foreign key, for instance

class Testing1(models.Model):
symbol = models.CharField('Ticker', max_length=32, primary_key=True)
tf = models.CharField('timeframe', max_length=1)

class Testing2(models.Model):
Testing1 = models.ForeignKey(Testing1, on_delete=models.CASCADE, related_name='Testing1Symbols')
price = models.CharField('price', max_length=1)

from django-pandas.

tlk3 avatar tlk3 commented on August 15, 2024

Why would you code it this way? Never seen this type of model / ForeignKey relationship. It's not logical.

from django-pandas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.