Category "pandas"

Python Dash - add submit button at the end of multiple inputs. Also format output table nicely

Want to create a dash board, with two or more inputs, a submit button at the end of inputs that outputs a table. I am having trouble creating properly spaced in

How to add new column to pandas group? Pandas forgets the column

I have a pandas dataframe indexed by createdAt grouped by pid (participant identifiers). The created at column are unix timestamps. Now I would like to add a ne

Creating a summary statistics table in python

I am trying to recreate the 'SummarySE()' function from R in python but I am having trouble getting it to work. The function creates a summary stats table from

Why ais my output "nan", keras model prediction

I'm trying to make an AI attempting to predict numbers from prime number sequence, but my model outputs "[[nan]]". My csv file is formatted like this: number of

Select how much data the pd.mean() displays?

When returning the pd.mean(), how to show only specific information? Example Now it gives this: new_df = pd.read_excel('example.xls', usecols = ['weight'] ) pri

NumPy array value error from training in Auto-Keras with StratifiedKFold

Background My sentiment analysis research comes across a variety of datasets. Recently I've encountered one dataset that somehow I just cannot train successfull

Combine Columns in Pandas

Let's say I have the following Pandas dataframe. It is what it is and the input can't be changed. df1 = pd.DataFrame(np.array([['a', 1,'e', 5],

Why is the output of the sklearn.feature_selection chi2 nan - can a feature with no variation not be compared to a feature with variation?

I want to build a heat map that correlates whether a feature is present in each column, with whether the feature is present in every other column. I have this:

ID3 algorithm: RecursionError: maximum recursion depth exceeded in comparison

I have this function to build ID3 decision tree: def buildTree(df,tree=None): Class = df.keys()[-1] #To make the code generic, changing target vari

Strange Plotly behaviour with Choropleth Mapbox

I want to create a choropleth map out of a GeoJSON file that looks like this: {"type": "FeatureCollection", "features": [ {'type': 'Feature', 'geometry': {'type

how to retrieve data from pandas

I am trying to retrieve the most recent data from the below results. The code I am running is: import datetime from Historic_Crypto import HistoricalData # Tim

Finding percentage of rejection in pandas dataframe

I have a pandas data frame like given below Id1 YEAR CLAIM_STATUS no_of_claims 1 2019-01 4 1 1 2019-01 5 1

Visualization random sample with displaCy

How can I visualize using displaCy in a dataframe? I have a data called taks_output and want to visualize a sample of the columm msg_lower? What I did: import p

Reshape wide to long for many columns with a common prefix

My frame has many pairs of identically named columns, with the only difference being the prefix. For example, player1.player.id and player2.player.id. Here's an

create dataframe as week and their weekly sum from dictionary of datetime and int

I have datetime and int values dictionary like below. details = { datetime.datetime.strptime("04-01-2021", "%d-%m-%Y") : 15, datetime.datetime.strptime(

Trying to convert pandas df to np array, dtaidistance computes list instead

I am attempting to compute the distance matrix for an ndarray that I have converted from pandas. I tried to convert the pandas df currently in this format: move

Import local ".py" library in powerbi python scripting

I have written a python library (ak_sql.py) to query my sql server and written another ".py" script (query_sql.py) to invoke this library and return data in dat

How to extract a specific range out of a dataframe and store it in another dataframe and then delete the range out of the original dataframe | pandas

I have some timeseries of energy consumption and i can eyeball when someone is on holidays if the consumption is under a certain range. I have this piece of cod

Nested JSON to Multiple Dataframe in Pandas

I am trying to build a tool which can take any JSON data and convert that into multiple data frame based on data types. I am trying to add each data frame with

Why is my function parameter for Pandas to_datetime() being ignored?

I have a Pandas data frame with a column containing months and years. Unfortunately, the values are currently string objects not datetime objects; This means th