Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
245 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 Reply

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...