They do better by going to school less!
Why we need to spend more money on energy related projects?
This is is really mind blowing. Are you satisfied with what your country spends on energy related research? Comment here.
Working with Matplotlib and Pandas (Python package for graphs)
import matplotlib.pyplot as plt
file = pd.read_excel('/full/path/to/file.xlsx')
When you run this, you may get following error.
ImportError: Install xlrd >= 0.9.0 for Excel support
To proceed further, install xlrd package using
pip install xlrd or pip3 install xlrdFor mentioning the sheet number in the excel sheet import.
Python Class: A simple and clear explanation.
I have been trying to understand class in python and failed to use it any useful purpose. Then, I came across this webage where I got a clear understanding of Class in Python. To understand this, I went through so many pages and blogposts. But I didn't get it.
https://micropyramid.com/blog/understand-self-and-__init__-method-in-python-class/
See the code blow (taken from above link).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | class Car(object): """ blueprint for car """ def __init__(self, model, color, company, speed_limit): self.color = color self.company = company self.speed_limit = speed_limit self.model = model def start(self): print("started") def stop(self): print("stopped") def accelarate(self): print("accelarating...") "accelarator functionality here" def change_gear(self, gear_type): print("gear changed") " gear related functionality here" |
This code is an example for a class in python language.
As you can see, this is a collection of functions (def) grouped in a class named Car.
What is the use of Class?
Class is used to collect list of definitions and provide a functionality to crosscommunicate with all other definitions inside the Class.
What is the best explanation for Class? Do you have any link?
Comment and provide link here.
Thanks.
Postdocs: Dos and Don'ts for getting tenure
Postdocs: What they should know?
Matplotlib y-axis label not displayed when saved as .eps .pdf file
When I tried to save the plotted graph in matplotlib, the y-axis label was not displayed in the saved file (.eps, .pdf, etc files).
Just add this line (as a previous line) before saving the graph as a file using savefig command.
plt.tight_layout()
Matpotlib error: Image size of 3831x7771797 pixels is too large. It must be less than 2^16 in each direction.
If you get this error, you may not visualize the figure(s) on the matplotlib.
However, you can save as a file (.pdf or .eps ir .png) and you can open and see the figures.
If you want to elimate the error message, the only solution is to decrease the file size (you may decrease the size of the figure or the pixel size)
Here is a related post in GitHub.
https://github.com/matplotlib/matplotlib/issues/16234
Another reason you may get this error may be due to the following reason.
If you have plt.text option as follow,
plt.text(6.0, 7.4, '(b)', ha='center', va='center', fontsize=14, rotation='horizontal', fontweight='bold')
then, this may be causing the problem (especially if you use alreadying existing script to plot figs.)
To solve this problem, just comment this plt.text() using # and try to save the file.
Now, if there is no error, you just adjust the location of the text values in the plt.text() to proper place.
This would solve this error.
How to translate documents from one language to another language using google drive (google docs)?
You can convert .doxc or .doc file from one language as follow:
1. First, upload the file (e.g. .docx) to google drive (Since the file is in .docx format, you can not find the translate option in Tools.)
2. Now Go to File --> Save As Google Docs.
3. Go to the file converted google docs. In this document, chose:
Tools --> Translate --> (select the language)
Now you will get the translated .docx doument.
Hope this helps. Comment here if this is useful.
You may be interested in these posts
Error in image file conversion: convert-im6.q16: not authorized `test.eps' @ error/constitute.c/WriteImage/1037.
This error is because of the vulnerability. This allows remote execution of code using image formats. So, some Linux distributions by defaul...