Hi,

You will have to parse the CSV file manually with a custom management
command (at least that is what I would do). All you need to do is open the
file, split each row with a "," and then  import the correct columns to the
model.

You can also use something like pandas to convert the CSV file into
something that you can create the models from. But that may be overkill in
your case.

Regards,

Andréas

2018-01-09 3:38 GMT+01:00 Tom Tanner <dontsendemailher...@gmail.com>:

> I have a tab-delimited data file that looks something like this:
>
>
> NAME S1903_C02_001E state county tract State-County-Tract-ID
> Census Tract 201, Autauga County, Alabama 66000 01 001 020100 01001020100
> Census Tract 202, Autauga County, Alabama 41107 01 001 020200 01001020200
> Census Tract 203, Autauga County, Alabama 51250 01 001 020300 01001020300
>
> I want to make a Django model named `MyModel` with three columns: "name",
> "data", and "geoid", which correspond to the file's columns "NAME",
> "S1903_C02_001E", and "State-County-Tract-ID." Can I do this via command
> line, or with a custom Python script? I'm running my Django project locally
> on a computer running Debian 9.3.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/389d8f38-6dbc-43a0-8a69-d20aa13ca844%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/389d8f38-6dbc-43a0-8a69-d20aa13ca844%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCfv_uvC5R89ykNxHzd1yJU-GZMSCGjVrGeLudAPC%3Dfc-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to