table for organizing students registration of subjects - python

I have to create my own subjects table, I have an excel file which contain subjects groups and dates that are available, I want to create a python program to run over all the combinations of subjects to give me all the available dates of subjects which I want to register in .
actually, I have no idea even how to start,
now I have four subjects let's call them F,N,S and G.
each one has four groups with different times along the week
so I want to generate all the available combinations which there is no overlap between subjects .
all I want is any hint, I don't want the whole solution just any intial thoughts to start.
I'm really a beginner python programmer and I can't think of any thing to launch this project
how to arrange them into matrices????????

Save the excel file as a csv, or "comma-separated values" file. This format is simple plaintext, and easy for programs to use.
In your program, read in the file using open()
Use the csv module to extract the opened file into a list of lists. Each element of the outer list should be another list: [subject, group, date] (or whatever columns are in your table.
Now that you have your information read into the program, look into solutions for the actual algorithm. You can google various scheduling algorithms, but this StackOverflow question gets at what you're looking for, I think, and might serve as a good starting point

Related

Searchable database of files

I have 1000's of scanned field books as PDF. Each has a unique filename. In a spreadsheet I have metadata for each, where each row has:
index number, filename, info1, info2, info3, info4, etc.
filename is the exact file name of the PDF. info1 is just an example of a metadata field, such as 'Year' or whatever. There are only about 8 fields or so, not ever PDF is relevant to all of them.
I assume there should be a reasonable way to create a database, mysql, or other, reading the spreadsheet (which I can just saves as .csv or .txt or something). This part I am sure I can handle.
I want to be able to lookup/search for a pdf file based on entering in various search items based on the metadata, and get a list of results. In a web interface, or a custom window, and be able to click on the results and open the file. Basically a typical search window with predefined fields you can enter and get results - like at an old school library terminal.
I have decent coding skills in python, mostly math, but some file skills as well. Looking for guidance on what tools and approach I should take to this. My short term goal is to be able to query and find files and open whatever results. Long term want to be able to share this with the public so they can search and find stuff.
After trying to figure out what to search for online, I am obviously at a loss. How do you suggest I do this and what tools or libraries should I use. I cannot find an example of this online. Not sure how to word it.
The actual data stuff could be done with Pandas:
read the excel file into Pandas
perform the search on the Pandas dataframe, e.g. using df.query()
But this does not give you a GUI. For that you could go for a web app, using Flask or Django framework. That, however, one does not master over night :)
This is a good course to learn that kind of stuff: https://www.edx.org/course/cs50s-web-programming-with-python-and-javascript?index=product&queryID=01efddd992de28a8b1b27d136111a2a8&position=3

I need a starting point to code an app to extract text from pdf to excel

To start I just want to state that I'm an Electrical Engineer with basic knowledge of programming.
My requirement is as follows:
I want to create an app where I can load and view PDF files that
contain tables.
These PDF files tables are of irregular shapes and in a different
position on every page. (that's why tools like tabular couldn't help
me)
Each table entry is multiline and of irregular dimensions (I cannot
select a whole row at a time it has to be each element alone. simply
copying the lines to excel won't work either because it will need a
lot of formatting)
So I want to be able to select each table entry individually from the
table (like a selection or cropping box over the required text),
delete new line if there is a new line in the text and just keep spaces.
The generated excel (or access database I do not really mind any)
should be reviewable and saveable (if those are even words XD).
I have a good knowledge of python and a very elementary knowledge of Django and I'm seeking some expert who can tell me what do I really need to learn (and if possible where to learn it) to execute my project.
Is it very much for me to execute and if I can dedicate 10 hours a week, how much would it take me to execute such a project.
Thanks all for your help in advance.
Don't use Python, use Word. Open the pdf, then step through the tables collection to collect the data and put it into excel. See this for an example
Here are the advises i can provide you :
first of all, ask internet for questions :
https://lmddgtfy.net/?q=python%20library%20tabular%20pdf
-> Camelot , which is mentioned multiple time seems to be relevant
For the use of excel sheet, i present you one of the most famous library for manipulating DataFrame: Pandas
You can use small courses on internet which will offer you a quick ability to manage your project easier.
for the application, you can easily find on youtube courses on a library made by someone who will explain you how to do a basic application. It could offer you the entry point you are talking about. Then, You can just wonder what else do you need or simply want for making it better.
for the time needed, it depends on how much time do you need to understand the basics, how much time you spend on having a deeper comprehension. I think in one week, working during your free time with a real interest, it could be working( not perfect, but working, which is a good beginning)
PS: I am not sure if your question is relevant for the aims of stackoverflow. I suggest you to read this file. ( https://stackoverflow.com/help/how-to-ask)

Looking for text in logs

I have a new project to develop a log reader in Python 3.5 from txt files and I don't know how to start. The main goal is to extract pieces of logs (substrings) from a large and complex log txt file and display it in a structured way on a webpage. Would be possible please any help with libraries and commands in order to start with? I'm sorry but I'm quite new to Python. Thanks!
I would say you convert the .txt files you mentioned into a list of strings, then use a for-loop:
for a in txt_files:
Then use some if statements to look out for keywords, and print certain messages depending on the input
using this method you could also have it look out for certain words in a certain order, by having "previous_a = a" at the end of each loop

python CSV intelligent parser and column matching

I've couple of thousands of CSV files where most of them have following columns
threadSubject
bccList
sender_name
recipient_names
sender
dateReceived
date
recipients
subject
Unfortunately depending on the CSV file each column if it is present might be at different columnt number therefore complicating parsing.
What I need to do is extract from the input CSV files only these selected columns and put them all into single output file.
I'm new to python and am sure there's perfectly easy way to achieve this but I can't figure it out.
I'm not sure if should use Pandas or other mechanism.
In logical code it should work more or less like this.
for file in (all files in current folder); do
open file;
get header and find out at which positions are interesting columns
#or match by column name;
dump interesting columns into output file in the right order;
close file;
done
The tricky part of me is get header...
Would any of you have any advise how to do it in smart pythonic way?
I thought about bash and parse it manually, but thought it might be a good idea to learn how to do it in python with your help.
p.s. background of it is that I need to go through all emails for last 5 years and find out at what time was sent out first email and last email during each day. The CSVs I've were created based on Thunderbird MSF files using Mork tool. Once I'll have this CSV parsing done, I'll need to find out easy way to get time of first email and last email on the same day. BUt this is another story.
Thanks in advance for all advises.
If the column names are the same in all the files , use csv.DictReader to do the job.
Python csv.DictReader Documentation
You can reference the field names directly rather than the column number.
import csv
file = open('Path_to_file','rb')
for record in csv.DictReader(file):
print record['Column_Name']
Hope this helps.

Grouping Together CSV Data Using Python

I have a question regarding how to perform a specific task using python. I feel like this should be pretty straightforward but I’m new to python and I can’t seem to locate a post which specifically addresses what I need to do, which is to group items together from a .csv file. Below I give a description of the csv file that I’m working with and the initial steps that I’m hoping to perform with the data contained in the form using python.
The csv file
The file was generated from a program that I have been using to administer questionnaires. Each ‘column’ has a header; each ‘row’ contains a Participant number and their responses to 100 questions: the questions are in the same order for each participant.
The steps
As mentioned, the data that I need to work with are answers to 100 questions. I need to group the questions into 10 sets of 10 questions each. I need to perform some simple analysis on 5 sets of the ten. After the analysis is complete I need to add 1 of each set of the 5 analyzed to 1 of each set of the 5 that have not been manipulated in any way.
The problem
The problem that I am having is that I cannot figure out a way to group data together from a csv file (such as 10 specific columns from a row) to make up a specific group. I’ve done a little reading and searching on the csv.dictReader_Writer mod/class but I have not come across an example of how to do this as of yet. Has anyone here performed this type of task before and if so, does one go about doing this? Unfortunately, I don’t have any code started as of yet as this would be one of the very first things that I would need to do, besides importing modules of course, in order to manipulate the data in any way.

Categories

Resources