tagged [python-2.7]

How to install Poppler on Windows?

How to install Poppler on Windows? The most recent version of [ScraperWiki](https://scraperwiki.com/) depends on [Poppler](https://en.wikipedia.org/wiki/Poppler_(software)) (or so the GitHub says). Un...

how to merge two data frames based on particular column in pandas python?

how to merge two data frames based on particular column in pandas python? I have to merge two dataframes: df1 df2 I have to unify both dataframes to one dataframe. I need output like:

30 Jun at 13:7

How do I iterate through the alphabet?

How do I iterate through the alphabet? 1. In Python, could I simply ++ a char? 2. What is an efficient way of doing this? I want to iterate through URLs and generate them in the following way:

12 Aug at 18:37

Python UTC datetime object's ISO format doesn't include Z (Zulu or Zero offset)

Python UTC datetime object's ISO format doesn't include Z (Zulu or Zero offset) Why python 2.7 doesn't include Z character (Zulu or zero offset) at the end of UTC datetime object's isoformat string un...

ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?

ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle? I use pickle to dump a file on python 3, and I use pickle to load the file on python 2, the ...

What is a good way to handle exceptions when trying to read a file in python?

What is a good way to handle exceptions when trying to read a file in python? I want to read a .csv file in python. - - Is there a prettier way to do it?

27 Feb at 20:32

Remove text between () and []

Remove text between () and [] I have a very long string of text with `()` and `[]` in it. I'm trying to remove the characters between the parentheses and brackets but I cannot figure out how. The list...

30 Jan at 13:14

Python how to plot graph sine wave

Python how to plot graph sine wave I have this signal : How can I plot a graph (this sine wave)? and create name of xlabel as 'voltage(V)' and ylabel as 'sample(n)' What code to do this? I am so thank...

21 Mar at 18:25

How to remove any URL within a string in Python

How to remove any URL within a string in Python I want to remove all URLs inside a string (replace them with "") I searched around but couldn't really find what I want. Example: I want the result to b...

4 Jul at 15:30

Python 'If not' syntax

Python 'If not' syntax I'm a bit confused about how/why so many python developers use `if not` in their conditional statements. for example, lets say we had a function, But why go about this way? I me...

24 May at 16:24

Use curly braces to initialize a Set in Python

Use curly braces to initialize a Set in Python I'm learning python, and I have a novice question about initializing sets. Through testing, I've discovered that a set can be initialized like so: Are th...

9 Jan at 22:14

Print range of numbers on same line

Print range of numbers on same line Using python I want to print a range of numbers on the same line. how can I do this using python, I can do it using C by not adding `\n`, but how can I do it using ...

25 Aug at 02:2

How to calculate 1st and 3rd quartiles?

How to calculate 1st and 3rd quartiles? I have DataFrame: I want to get 1st quartile, 3rd quartile and median for the column `time_diff`. To obtain median, I use `np.median(df["time_diff"].values)`. H...

28 Aug at 19:38

How to check deque length in Python

How to check deque length in Python How to check a deque's length in python? I don't see they provide deque.length in Python... [http://docs.python.org/tutorial/datastructures.html](http://docs.python...

What is the difference between json.load() and json.loads() functions

What is the difference between json.load() and json.loads() functions In Python, what is the difference between `json.load()` and `json.loads()`? I guess that the function must be used with a file obj...

28 Oct at 17:45

In Python, how do you convert a `datetime` object to seconds?

In Python, how do you convert a `datetime` object to seconds? I have a bunch of datetime objects and I want to calculate the number of seconds since a fixed time in the past for each one (for example ...

29 Dec at 00:54

Python Save to file

Python Save to file I would like to save a string to a file with a python program named `Failed.py` Here is what I have so far: ``` myFile = open('today','r') ips = {} for line in myFile: parts = li...

22 Oct at 17:40

Insert an element at a specific index in a list and return the updated list

Insert an element at a specific index in a list and return the updated list I have this: Is there a way I can get the updated list as the result, instead of updating the original list in place?

23 Aug at 19:10

Python: How to get stdout after running os.system?

Python: How to get stdout after running os.system? I want to get the `stdout` in a variable after running the `os.system` call. Lets take this line as an example: `result` will contain the error code ...

iterate through all rows in specific column openpyxl

iterate through all rows in specific column openpyxl I cannot figure out how to iterate through all rows in a specified column with openpyxl. I want to print all of the cell values for all rows in col...

27 Jul at 17:30

Get the first element of each tuple in a list in Python

Get the first element of each tuple in a list in Python An SQL query gives me a list of tuples, like this: I'd like to have all the first elements of each tuple. Right now I use this: But I think ther...

15 Dec at 16:22

How to open html file that contains Unicode characters?

How to open html file that contains Unicode characters? I have html file called `test.html` it has one word `בדיקה`. I open the test.html and print it's content using this block of code: but it prints...

Drop all data in a pandas dataframe

Drop all data in a pandas dataframe I would like to drop all data in a pandas dataframe, but am getting `TypeError: drop() takes at least 2 arguments (3 given)`. I essentially want a blank dataframe w...

26 Aug at 20:9

Comparing two pandas dataframes for differences

Comparing two pandas dataframes for differences I've got a script updating 5-10 columns worth of data , but sometimes the start csv will be identical to the end csv so instead of writing an identical ...

31 Dec at 14:17

How to delete all instances of a character in a string in python?

How to delete all instances of a character in a string in python? How do I delete all the instances of a character in this string? Here is my code: However, if I run this, this is what happens: ``` >>...

5 Mar at 02:23