I’m using tweepy in order to extract data from tweets in Python. Now I’d like to search up the popularity of certain hashtags which should be returned in form of an integer. I’m thinking of a command like: I couldn’t really find anything online, so I’d be very grateful for any hi…
Tag: python
How to use the value in a variable as name to create a panda data frame?
In [182]: colname Out[182]: ‘col1’ In [183]: x= ‘df_’ + colname In [184]: x Out[184]: ‘df_col1’ May I know how to create a new pandas data frame with x, such that the new data frame’s name would be df_col1 Answer You can use the locals() function as given below,
Class variables not callable?
I’ve stumbled on what is probably a simple issue but I struggle to think of a solution. If I try to make a class variable that equates to a number or an array index they come up with these errors and This seems odd since I can set variables equal to ints and arrays elsewhere. What am I missing and
Is there a way to host a python function (in azure or elsewhere) with list input/output?
I’m getting into Azure a little bit, and have been through their tutorials here. This, however, seems like it’s only good for a string query to the HTTPTrigger. I’m wondering if there is a way to do something like: I’m not too familiar with how Azure functions work, or if this is even …
Python: How do I read the data in this multipage TIFF file to produce the desired image?
I am working with TIFF files that represent the readings of detectors in electron microscopy, and I know how this particular image should look, but I’m unsure how to get that result from the raw data in question. The TIFF files in question have several pages corresponding to frames on which data was tak…
Substitute the variables of a polynomial with caracas (Sympy)
I have a long polynomial in four variables x, y, z, w: I’m working with R. I want to use the caracas package (a wrapper of Sympy) to get this expression as a polynomial after doing a change of variables. Namely, I want to substitue x, y, z and w by respectively. I tried subs with no luck. Here is
Imported function changes when running changes imported variable
I am coding Chess and for past three days i’ve been stuck on this problem: When i run simulate_play_and_check function which is imported from funcs.py file it takes arguments and changes them in a main file and i dont know why. When i print board.board before running this function it prints: After runni…
Python: for loop that drops a column to meet condition
I have a dataframe that looks as follows: Beta is calculated as ((sum of each row)^2)/10. I want to keep dropping columns until Beta is less than or equal to 1 for all rows. So far I have How can I stop the loop when all values of beta are below or equal to 1? Answer First of all, if
How to fit a power law to the dataframe and plot it?
I have two columns(rcs,range) in a dataframe. rcs range -40 12.9 -35 14.9 -30 22.9 -25 35.44 -20 43.48 -15 62.4 -10 92.4 -5 132.99 0 182.6 5 252.99 I want to plot a curve with equation rcs = range^4 I tried the following 1.as a polynomial curve fitting in the above plot,the curve is not a smooth curve and
How to use pyarrow parquet with multiprocessing
I want to read multiple hdfs files simultaneously using pyarrow and multiprocessing. The simple python script works (see below), but if I try to do the same thing with multiprocessing, then it hangs indefinitely. My only guess is that env is different somehow, but all the environment variable should be the sa…