Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
247 views
in Technique[技术] by (71.8m points)

database - How do i import this to phmyadmin wherein the rows are seperated by table?

csv dataset that I am having trouble with importing. Example data column names:

Name   |   Role   |   Room.Code   |   Room.Instructor   |   Subjects.Status   |

Is it possible to import this .csv file where in any column name with . for example: Room.Code will be imported in a separate table called Room? with the column name Code and Instructor.

Thanks in advance.

question from:https://stackoverflow.com/questions/65904446/how-do-i-import-this-to-phmyadmin-wherein-the-rows-are-seperated-by-table

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Python is the answer.

With pymysql and numpy, you could.

Use numpy.genfromtxt() to convert CSV to a numpy array. From there, split the table using python code, and have it base it on the name of the column.

This code would probably take maybe an hour or so to make, so if the dataset is really big, it might be worth it.

After you get the seperated numpy arrays, use pymysql to put them into phpmyadmin(like you are using currently).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...