I am currently in the position where one of my home devices sends the data of each day in form of a .csv file via email.
Thereby I can tell the device to whatever email (also multiple) it should send this file at the end of the day.
The email only contains this one file attached to it.
So, this is what I am working with.
I now would like to create my own statistics of the data using python, where I could add the data every day and calculate, plot etc.
The question is, how can I automatically download a file which is sent to me via email? I simply have no idea where to start. I was thinking about setting up an raspberry pi with some sort of email adress, but as you can tell I simply have no idea...
It would be great if someone would have a suggestion, or also maybe a link or documentation on stuff like this where I can teach it myself.
Thank you very much
Here is a link to medium article that has instructions how to download attachments that came with the email
The program could read the csv file with Pandas library. You can do all sorts of data manipulation and also some plotting with pandas. But If you want to have really good plots you could use matplotlib and seaborn
All this you could run in cloud maybe? I have zero experience with running projects in cloud so I can't really tell, but I've heard that you can do this. Maybe you could use AWS to do this?
That's how I would do it.
Googling any of the keywords such as pandas or AWS gives you tons and tons of tutorials.
Related
Thanks for taking the time to read my question.
I am working on a personal project to learn python scripting for excel, and I want to learn how to move data from one workbook to another.
In this example, I am emulating a company employee ledger that has name, position, address, and more (The organizations is by row so every employee takes up one row). But the project is to have a selected number of people be transferred to a new ledger (another excel file). So I have a list of emails in a .txt file (it could even be another excel file but I thought .txt would be easier), and I would want the script to run through the .txt file, get the emails, and look for any rows that have a matching email address(all emails are in cell 'B'). And if any are found, then copy that entire row to the new excel file.
I tried a lot of ways to make this work, but I could not figure it out. I am really new to python so I am not even sure if this is possible. Would really appreciate some help!
You have essentially two packages that will allow manipulation of Excel files. For reading in data and performing analysis the standard package for use is pandas. You can save the files as .xlsx however you are only really working with base table data and not the file itself (IE, you are extracing data FROM the file, not working WITH the file)
However what you need is really to perform manipulation on Excel files directly which is better done with openpyxl
You can also read files (such as your text file) using with open function that is native to Python and is not a third party import like pandas or openpyxl.
Part of learning to program includes learning how to use documentation.
As such, here is the documentation you require with sufficient examples to learn openpyxl: https://openpyxl.readthedocs.io/en/stable/
And you can learn about pandas here: https://pandas.pydata.org/docs/user_guide/index.html
And you can learn about python with open here: https://docs.python.org/3/tutorial/inputoutput.html
Hope this helps.
EDIT: It's possible I or another person can give you a specific example using your data / code etc, but you would have to provide it fully. Since you're learning, I suggest using the documentation or youtube.
This is my first post on stack.
I'm looking to gather a large amount of data from a multitude of files on PW so I can quantify a few things about the records.
The directories I'm working with have unique numbers and offer files that are all similar to files in other folders.
Is there a library from python I can use or any other useful tips for taking on this task?
It could potentially save many hours of work if I can do this with code.
A pseudocode example may look like.
for element in dataField:
search(folder)
if folder found:
search(file)
if file found
extract certain data from file X
extractedData.append(data)
Thank you,
R
Based off a quick web search for projectwise api, there is a web-based REST API available, so you'll definitely want to look into that more. You'll need to read the docs carefully to figure out which endpoint does what, but once you know what information you need to send and what kind of data you'll receive, programming a basic Python interface shouldn't be too difficult. One may already exist, I didn't look too hard.
I have eight calendars in Google Calendar each having a bunch of events. I would like to export each of these calendars (with all of their events) to their own file. I'll be using Python to write the script, and the script would run nightly from my crontab.
Does the GCal API actually have (a) method(s) for doing this type of export? How would I go about doing this?
Apologies for such a generalized question -- I'm having trouble even getting started with this problem:
I've looked through the Calendar API Reference and was unable to find any clear method for exporting a calendar to a file.
I searched StackOverflow for [google-calendar-api] export and read through the first nine pages of results and there was only one question resembling my problem. The answer is about three years old and doesn't adequately answer the question (or, I just don't understand the answer enough to make use of it).
There is no method to export calendars in the Calendar API. Also depending on what is your desired output format, the adequate answer may be different. Here are some options that come to my mind:
Using the Google Calendar API. First of all you would need to call CalendarList.list() to obtain all your calendars, and after that use the Events.list() call to obtain every event for each calendar.
Import your calendar as an ICAL file using the Secret Address. The idea is that you can obtain a link to a download file that includes all your calendar information, and you simply have to issue a GET request to it. Bear in mind, however, that this address has to be kept private, as anybody possessing it can access all of your calendar information. You can read more about this in the official documentation here.
I'm building a website that'll have a django backend. I want to be able to serve the medical billing data from a database that django will have access to. However, all of the data we receive is in excel spreadsheets. So I've been looking for a way to get the data from a spreadsheet, and then import it into a django model. I know there are some different django packages that can do this, but I'm having a hard time understanding how to use these packages. On top of that I'm using python 3 for this project. I've used win32com for automation stuff in excel in the past. I could write a function that could grab the data from the spreadsheet. Though what I want figure out is how would I write the data to a django model? Any advice is appreciated.
Use http://www.python-excel.org/ and consider this process:
Make a view where user can upload the xls file.
Open the file with xlrd. xlrd.open_workbook(filename)
Extract, create dict to map the data you want to sync in db.
Use the models to add, update or delete the information.
If you follow the process, you can learn a lot of how loading and extracting works and how does it fits with the requirements. I recommend to you first do the step 2 and 3 in shell to get more quicker experiments and avoid to be uploading/testing/error with a django view.
Hope this kickoff base works for you.
Why don't you use django-import-export?
It's a widget that allows you to import excel files from admin section.
It's very easy to install, here you find the installation tutorial, and here an example.
Excel spreadsheets are saved as .csv files, and there are plenty of examples and explanations on how to work with them, such as here and here, online already.
In general, if you are having difficulty understanding documentation or packages, my advice would be to search for specific examples or see if whatever you are trying to do has already been done. Play with it to get a working understanding, and then modify it to fit your needs.
Hi is this scenario possible?
In My Server-PC i got this library of movie files,
then
In one of my Client-PC's, They Access or Copy a movie file from the Server-PC BUT stores it only on the RAM/Memory?
If This is possible How can i Read/Open/Play it?
Im trying to make a program (In Python 2.6 with QT) for students in our schools that plays the video, but dont leave a file on their PC's since those Video Material is licensed by the owner. and doesn't want other
school to use it, since's its only made for the school itself.
please im open to any kind of help.
You will get an abundant Audio/Video Resources out in this link. The Particular thing that you wan't to achieve is called Audio/Video Streaming. There are few libraries that provide this functionality one of which is Flumotion. If you have not worked or do not know what Media Streaming is, just fiddle with VLC which provided the same functionality as you are desiring. This will give you an idea what you intend to develop.