mirror of
https://github.com/nprasad2077/nbaStats.git
synced 2026-11-05 01:25:48 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b1814369b | ||
|
|
39535055a5 | ||
|
|
3ced0d278b |
No files matched your search
@@ -0,0 +1,18 @@
|
|||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from nba_data.models import PlayerAdvancedData
|
||||||
|
from django.db import connection
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
# Provides a description for use with the custom django management command (python manage.py help).
|
||||||
|
help = 'Delete all player ADVANCED data with season specified and reset primary key sequence in DB'
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
# Delete player data with season
|
||||||
|
season = 2006
|
||||||
|
PlayerAdvancedData.objects.filter(season=season).delete()
|
||||||
|
|
||||||
|
# Reset the PK sequence
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
cursor.execute('ALTER SEQUENCE nba_data_playeradvanceddata_id_seq RESTART WITH 1;')
|
||||||
|
|
||||||
|
self.stdout.write(self.style.SUCCESS('Successfully deleted all players with season = {} in DB'.format(season)))
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.2 on 2023-09-20 07:36
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('nba_data', '0017_alter_playershotchartdata_result'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='playeradvanceddata',
|
||||||
|
name='ft_attempt_rate',
|
||||||
|
field=models.DecimalField(decimal_places=3, max_digits=8, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
+1
-1
@@ -79,7 +79,7 @@ class PlayerAdvancedData(models.Model):
|
|||||||
PER = models.DecimalField(max_digits=6, decimal_places=1, null=True)
|
PER = models.DecimalField(max_digits=6, decimal_places=1, null=True)
|
||||||
TS_percent = models.DecimalField(max_digits=5, decimal_places=3, null=True)
|
TS_percent = models.DecimalField(max_digits=5, decimal_places=3, null=True)
|
||||||
three_p_attempt_rate = models.DecimalField(max_digits=5, decimal_places=3, null=True)
|
three_p_attempt_rate = models.DecimalField(max_digits=5, decimal_places=3, null=True)
|
||||||
ft_attempt_rate = models.DecimalField(max_digits=5, decimal_places=3, null=True)
|
ft_attempt_rate = models.DecimalField(max_digits=8, decimal_places=3, null=True)
|
||||||
orb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True)
|
orb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True)
|
||||||
drb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True)
|
drb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True)
|
||||||
trb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True)
|
trb_percent = models.DecimalField(max_digits=5, decimal_places=2, null=True)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ season = input('What season? ')
|
|||||||
|
|
||||||
teams2 = 'PHI'
|
teams2 = 'PHI'
|
||||||
|
|
||||||
for team in teams2:
|
for team in teams_data:
|
||||||
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
|
url_make = 'https://www.basketball-reference.com/teams/' + team + '/' + season + '.html'
|
||||||
response = requests.get(url_make)
|
response = requests.get(url_make)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user