id
stringlengths
7
11
source
stringclasses
1 value
category
stringclasses
11 values
title
stringlengths
15
214
text
stringlengths
70
30.5k
url
stringlengths
57
160
tags
stringlengths
3
113
created_at
int64
1.22B
1.79B
se_67210952
stackoverflow
DATA_SCIENCE
Pandas groupby with pd.cut
Pandas groupby with pd.cut I have the following dataframe The chr column is for chromosome number and pos is for the specific position in it. The pos column is sorted in ascending order. I need to split each chromosome into equal bins of 100, 1000, 10000, etc. E.g. for bin value 100 chr 1 would be splitted into bins ...
https://stackoverflow.com/questions/67210952/pandas-groupby-with-pd-cut
python, pandas, dataframe, data-science
1,619,085,272
se_76439597
stackoverflow
DATA_SCIENCE
Normallity Tests and Data Science
Normallity Tests and Data Science I have a dataset and I wanted to check if some variables follow a normal distribution. So, I have read about normallity test but it seem to be sensitive when the amout of data is large and, apparantly when I plot the histogram and the QQ-Plot, the variable seem to be normal. Should I ...
https://stackoverflow.com/questions/76439597/normallity-tests-and-data-science
data-science, statistical-test
1,686,308,271
se_74494041
stackoverflow
DATA_SCIENCE
OSError: Starting path not found (dotenv-0.21.0-py3.9.egg) (python)
OSError: Starting path not found (dotenv-0.21.0-py3.9.egg) (python) I'm developing a script in Python 3.9 that works perfectly on my personal PC. When I tried moving and running it on a server, it gives me the following error: there the error Does anyone know how to fix this error? Laptop version: 3.10.7 server versio...
https://stackoverflow.com/questions/74494041/oserror-starting-path-not-found-dotenv-0-21-0-py3-9-egg-python
python-3.x, data-science, dotenv, python-dotenv
1,668,796,709
se_75540940
stackoverflow
DATA_SCIENCE
installing graphviz in macos
installing graphviz in macos I installed Brew and try to install graphviz using the command"brew install graphviz" whereas "Error: graphviz: Failed to download resource "netpbm" Failure while executing; /usr/bin/env svn checkout https://svn.code.sf.net/p/netpbm/code/stable /Users/gj/Library/Caches/Homebrew/netpbm--sv...
https://stackoverflow.com/questions/75540940/installing-graphviz-in-macos
python, jupyter-notebook, data-science
1,677,130,521
se_68126025
stackoverflow
DATA_SCIENCE
Filter out rows of a dataframe containing a specific string
Filter out rows of a dataframe containing a specific string I have a massive dataframe. The dataframe has column patient.drug. This column contains list of dictionaries as its elements. I want to filter out all the rows that contain 'NIFEDIPINE' word in patient.drug column. The dataframe is very large. Here is a sampl...
https://stackoverflow.com/questions/68126025/filter-out-rows-of-a-dataframe-containing-a-specific-string
python, pandas, dataframe, data-science
1,624,599,756
se_76833379
stackoverflow
DATA_SCIENCE
Question about the graphs of marginal effect in interaction terms and its hypothesis test in ggpredict()
Question about the graphs of marginal effect in interaction terms and its hypothesis test in ggpredict() I met a problem when trying to visualize the marginal effect of my model. My code is as follows: fit7am=svyglm(formula=visa~age+male+pregnant+foreigner+fujian+migrant+agent+disadveth+ifoplive+otherpaidtrip+geotrave...
https://stackoverflow.com/questions/76833379/question-about-the-graphs-of-marginal-effect-in-interaction-terms-and-its-hypoth
r, data-science, visualization, margin, interaction
1,691,129,721
se_69658338
stackoverflow
DATA_SCIENCE
Can t-test be calculated on large samples with non-normal distribution?
Can t-test be calculated on large samples with non-normal distribution? Can t-test be calculated on large samples with non-normal distribution? For example, the number of users in group A is 100K, the number of users in group B is 100K. I want to test whether the average session duration of these two groups is statist...
https://stackoverflow.com/questions/69658338/can-t-test-be-calculated-on-large-samples-with-non-normal-distribution
statistics, data-science, normal-distribution, ab-testing, t-test
1,634,804,359
se_69188247
stackoverflow
DATA_SCIENCE
Converting data frame column values to float type
Converting data frame column values to float type My dataset has two columns, 'A' and 'B,' both of which have percentage values but are of the object datatype. For example, A% B% 1.x% 3.x% 2.x% 4.x% Goal: I'm mostly interested in using this for machine learning clustering, hence my goal is to convert it ...
https://stackoverflow.com/questions/69188247/converting-data-frame-column-values-to-float-type
python, pandas, dataframe, function, data-science
1,631,688,443
se_59397499
stackoverflow
DATA_SCIENCE
How to use groupby with integer values in dataframe
How to use groupby with integer values in dataframe I have a data frame with one column and 793 entries with following distribution df.groupby([‘OK2Use`]).size() OK2Use 0 305 1 150 2 338 dtype: int64 How do I access individual sums namely 305, 150 and 338?. I see examples like grouped_df.get_group('value')...
https://stackoverflow.com/questions/59397499/how-to-use-groupby-with-integer-values-in-dataframe
python, pandas, pandas-groupby, data-science
1,576,690,947
se_59815894
stackoverflow
DATA_SCIENCE
Training Machine Learning in Production
Training Machine Learning in Production Is there a way to train your machine learning model in the cloud? Or does it really have to be batch training? i.e. (Pull some data on SQL, then feed that to the model) What i was thinking is implementing my own model from scratch, use Stochastic Gradient Descent to update the ...
https://stackoverflow.com/questions/59815894/training-machine-learning-in-production
python, machine-learning, data-science
1,579,482,851
se_75183542
stackoverflow
DATA_SCIENCE
Assigning Final Scores to Identified Technologies: Considering Users' StackOverflow Reputation, badge counts, post scores, no.of posts, and post date
Assigning Final Scores to Identified Technologies: Considering Users' StackOverflow Reputation, badge counts, post scores, no.of posts, and post date I am trying to determine the importance of various factors in assigning a score for identified technologies using the user's StackOverflow post tags and content. The...
https://stackoverflow.com/questions/75183542/assigning-final-scores-to-identified-technologies-considering-users-stackoverf
tags, data-science, weighted, scoring
1,674,214,849
se_76617953
stackoverflow
DATA_SCIENCE
Not_Fitted_Error : This LabelEncoder instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator
Not_Fitted_Error : This LabelEncoder instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator I am new to Ml_Modelling I am working on a solution to create a model with three columns nature_of_business , industry, products. nature_of_business industry products Manuf...
https://stackoverflow.com/questions/76617953/not-fitted-error-this-labelencoder-instance-is-not-fitted-yet-call-fit-with
python, pandas, numpy, machine-learning, data-science
1,688,541,756
se_76797633
stackoverflow
DATA_SCIENCE
How to perform Time series forecasting in short Interval of time data (only 8 years are given) for multiple locations?
How to perform Time series forecasting in short Interval of time data (only 8 years are given) for multiple locations? I want to find the production of field forecasting in year 2018 and 2019 at multiple location for a short interval of data? At each Harvesting Site(donated by index in the image and by its Latitute an...
https://stackoverflow.com/questions/76797633/how-to-perform-time-series-forecasting-in-short-interval-of-time-data-only-8-ye
python, machine-learning, time-series, data-science, forecasting
1,690,717,947
se_76859900
stackoverflow
DATA_SCIENCE
When I use Filtered_tg in R. The console show this error :- Error in arrange(filtered_tg, len) : could not find function "arrange"
When I use Filtered_tg in R. The console show this error :- Error in arrange(filtered_tg, len) : could not find function &quot;arrange&quot; Error show in Rstdio I try to fix it but and watch video in youtube but I can't found where is the problem I code this:- data("ToothGrowth") View(ToothGrowth) filtered_tg <- fil...
https://stackoverflow.com/questions/76859900/when-i-use-filtered-tg-in-r-the-console-show-this-error-error-in-arrangefil
google-analytics, data-science, data-analysis
1,691,500,207
se_76763488
stackoverflow
DATA_SCIENCE
Is there anything to increase the accuracy of this predictive model?
Is there anything to increase the accuracy of this predictive model? I want to improve the accuracy of my trained model. I tried to create an ML model to predict whether a test sample belongs to someone with or without disease, based on the gene expression profiling, if it is possible at all. I looked up some resource...
https://stackoverflow.com/questions/76763488/is-there-anything-to-increase-the-accuracy-of-this-predictive-model
python, machine-learning, deep-learning, data-science
1,690,293,498
se_73556668
stackoverflow
DATA_SCIENCE
Recalculate the values of the binary classification probabilities based on the threshold
Recalculate the values of the binary classification probabilities based on the threshold I have highly imbalanced data so for binary classification I convert probabilities for 1-class with threshold = 0.06. I want to show probabilities to management so I need to adjust then on condition that 0.06 is my new 50% boundar...
https://stackoverflow.com/questions/73556668/recalculate-the-values-of-the-binary-classification-probabilities-based-on-the-t
python, machine-learning, regression, data-science, classification
1,661,952,607
se_76826329
stackoverflow
DATA_SCIENCE
Microsoft Graph api connection
Microsoft Graph api connection I am trying to get the email details from Outlook emails using Python. we got the access token, But While trying to get the email details, we are facing different issues like OrganizationGuidNotfound, and MailboxNotEnabledForRESTAPI. we tried to get email details using Postman also but t...
https://stackoverflow.com/questions/76826329/microsoft-graph-api-connection
outlook, microsoft-graph-api, data-science
1,691,052,125
se_76813915
stackoverflow
DATA_SCIENCE
How is this plot plotted?
How is this plot plotted? I know about TPR values, FPR values, roc curve and the associated auc score. The roc curve plots fpr and tpr. I use python sklearn library for all these. But I came across this plot which I could not understand. For different thresholds we have different fpr and tpr and we plot them to get ro...
https://stackoverflow.com/questions/76813915/how-is-this-plot-plotted
python, matplotlib, plot, data-science
1,690,910,281
se_70499480
stackoverflow
DATA_SCIENCE
Use Google Colab Resources on local IDE
Use Google Colab Resources on local IDE I have a big doubt... is see a lot of blog posts where they say that you can use the Colab front-end to edit a local Jupiter Notebook However I don't see the point... the actual advantage would be to use something like DataSpell or some local IDE, on a remote Notebook on Colab, ...
https://stackoverflow.com/questions/70499480/use-google-colab-resources-on-local-ide
ide, data-science, google-colaboratory
1,640,632,204
se_58529018
stackoverflow
DATA_SCIENCE
Time Series Forecasting: weekly vs daily predictions
Time Series Forecasting: weekly vs daily predictions I have some daily time series data. I am trying to predict the next 3 days from the historical daily set of data. The historical data shows a definite trend based upon the day-of-week such as Monday, Tuesday, etc Monday and Tuesdays are high, Wednesday typically hig...
https://stackoverflow.com/questions/58529018/time-series-forecasting-weekly-vs-daily-predictions
machine-learning, time-series, data-science, arima
1,571,855,351
se_76844343
stackoverflow
DATA_SCIENCE
How can we map catagorical codes in a dataframe back to the original data points in the original dataframe?
How can we map catagorical codes in a dataframe back to the original data points in the original dataframe? I have a simple dataframe that looks like this. import pandas as pd # Intitialise data of lists data = [{'Year': 2020, 'Airport':2000, 'Casino':5000, 'Stadium':9000, 'Size':'Small'}, {'Year': 2019, 'Ai...
https://stackoverflow.com/questions/76844343/how-can-we-map-catagorical-codes-in-a-dataframe-back-to-the-original-data-points
python, python-3.x, dataframe, machine-learning, data-science
1,691,293,502
se_76824984
stackoverflow
DATA_SCIENCE
How to change a string value with comma (343,543) to int in a dataframe with Python
How to change a string value with comma (343,543) to int in a dataframe with Python I have a CVS file IMDb list. The number of votes is written like 345,545, and Python sees this like a string. I want to change this to a number value for using operations like <,+,% and I want to add those values in a new column. def c...
https://stackoverflow.com/questions/76824984/how-to-change-a-string-value-with-comma-343-543-to-int-in-a-dataframe-with-pyt
python, pandas, dataframe, data-science, data-analysis
1,691,038,842
se_76828158
stackoverflow
DATA_SCIENCE
in python pandas data frame shift values from Category to Rating, Rating to Reviews, ............ ,Current Ver to Android Ver
in python pandas data frame shift values from Category to Rating, Rating to Reviews, ............ ,Current Ver to Android Ver This is my main data: I need to change this line of data: This is my output: In python pandas data frame shift values from Category to Rating, Rating to Reviews, etc. Current Ver to Android ...
https://stackoverflow.com/questions/76828158/in-python-pandas-data-frame-shift-values-from-category-to-rating-rating-to-revi
python, pandas, dataframe, data-science
1,691,066,454
se_76824269
stackoverflow
DATA_SCIENCE
Is there a way to generate a completely new text column for a pandas dataframe?
Is there a way to generate a completely new text column for a pandas dataframe? I have a pandas dataframe that contains multiple features such as age, gender , many symptoms with the values 0 or 1 indicating if the patient has that particular symptom or not and the target being his final diagnosis. I want to add a new...
https://stackoverflow.com/questions/76824269/is-there-a-way-to-generate-a-completely-new-text-column-for-a-pandas-dataframe
python, pandas, nlp, data-science, huggingface-transformers
1,691,023,279
se_76812704
stackoverflow
DATA_SCIENCE
How to download XLSX file from DOI link?
How to download XLSX file from DOI link? I want to download two files automatically from Python for a reproducible statistical analysis. These links https://doi.org/10.1371/journal.pone.0282068.s001 https://doi.org/10.1371/journal.pone.0282068.s002 I tried import requests url = 'https://doi.org/10.1371/journal.pone...
https://stackoverflow.com/questions/76812704/how-to-download-xlsx-file-from-doi-link
python, data-science, doi
1,690,900,376
se_70399861
stackoverflow
DATA_SCIENCE
convert minimum spanning tree to list of indices using scipy?
convert minimum spanning tree to list of indices using scipy? If I have the following input and output graphs input graph minimum spanning tree (0) (0) / \ / 3 8 3 / \ / (3)---5---(1) ...
https://stackoverflow.com/questions/70399861/convert-minimum-spanning-tree-to-list-of-indices-using-scipy
python, python-3.x, scipy, data-science, sparse-matrix
1,639,784,121
se_76799005
stackoverflow
DATA_SCIENCE
Python 3 ipykernel hangs on a particular line of code
Python 3 ipykernel hangs on a particular line of code I tried training a Linear regression model using model.fit on jupyter notebook as usual but my kernel is not executing the particular line of code and no error message. import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns dat...
https://stackoverflow.com/questions/76799005/python-3-ipykernel-hangs-on-a-particular-line-of-code
jupyter-notebook, data-science, jupyter-irkernel
1,690,739,425
se_76685550
stackoverflow
DATA_SCIENCE
How to access child class from parent class in web scraping using python
How to access child class from parent class in web scraping using python from bs4 import BeautifulSoup import requests import pandas as pd data={"title":[],"price":[]} header={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"} url="ht...
https://stackoverflow.com/questions/76685550/how-to-access-child-class-from-parent-class-in-web-scraping-using-python
python, web-scraping, beautifulsoup, data-science
1,689,319,668
se_70578172
stackoverflow
DATA_SCIENCE
Can we use data directly from RDS or df as a data source for training job in Sagemaker, rather than pulling it from from s3 or EFS?
Can we use data directly from RDS or df as a data source for training job in Sagemaker, rather than pulling it from from s3 or EFS? I am using Sagemaker platform for model development and deployment. Data is read from RDS tables and then spitted to train and test df. To create the training job in Sagemaker, I found th...
https://stackoverflow.com/questions/70578172/can-we-use-data-directly-from-rds-or-df-as-a-data-source-for-training-job-in-sag
python, amazon-web-services, data-science, amazon-sagemaker
1,641,296,123
se_76762396
stackoverflow
DATA_SCIENCE
How to simulate ARIMA model data in python? using statsmodels.tsa.arima.model.ARIMA.simulate()
How to simulate ARIMA model data in python? using statsmodels.tsa.arima.model.ARIMA.simulate() Need to know how to simulate data in python using statsmodels.tsa.arima.model.ARIMA.simulate() Hitting error : TypeError: MLEModel.simulate() missing 1 required positional argument: 'self' self=? IDK why ? Process=? nsimul...
https://stackoverflow.com/questions/76762396/how-to-simulate-arima-model-data-in-python-using-statsmodels-tsa-arima-model-ar
python, data-science, statsmodels, arima
1,690,285,664
se_76781507
stackoverflow
DATA_SCIENCE
My test and train data has the same number of columns but OneHotEncoder creates different size of matrixes
My test and train data has the same number of columns but OneHotEncoder creates different size of matrixes I am trying to create a model with train and test datasets which are seperate. They have same number of columns. When I try to encode categorical features the created matrix by OneHotEncoder is comes with differe...
https://stackoverflow.com/questions/76781507/my-test-and-train-data-has-the-same-number-of-columns-but-onehotencoder-creates
pandas, machine-learning, scikit-learn, data-science, random-forest
1,690,473,257
se_67450869
stackoverflow
DATA_SCIENCE
Distill y_true and y_pred from a confusion matrix
Distill y_true and y_pred from a confusion matrix I have a confusion matrix that I generated via Scikit-Learn. I was wondering if it were possible to reverse engineer it and get the y_true and y_pred given only the confusion matrix in Python. If there is nothing built in (like in Scikit-Learn), would someone mind prov...
https://stackoverflow.com/questions/67450869/distill-y-true-and-y-pred-from-a-confusion-matrix
python, scikit-learn, data-science
1,620,498,389
se_76759294
stackoverflow
DATA_SCIENCE
How to allow user to reorder list when presented with one?
How to allow user to reorder list when presented with one? I want to create a list of unique values from a column of a DataFrame and then allow the user to sort the list arbitrarily based on their preference of the items in the list. For example: fruit_info = pd.read_csv('Fruit Information.csv') fruit_list = (fruit_in...
https://stackoverflow.com/questions/76759294/how-to-allow-user-to-reorder-list-when-presented-with-one
python, pandas, sorting, for-loop, data-science
1,690,256,250
se_76753693
stackoverflow
DATA_SCIENCE
Creating Dynamic Folders based on Filename in Azure Data Factory DataFlow
Creating Dynamic Folders based on Filename in Azure Data Factory DataFlow I am working on an Azure Data Factory data flow pipeline where I have a Sink activity. One of the columns in the sink contains filename information in the format "2023-07-19_diane_12345.csv". I want to use a pattern to extract specific data from...
https://stackoverflow.com/questions/76753693/creating-dynamic-folders-based-on-filename-in-azure-data-factory-dataflow
azure, data-science, azure-data-factory
1,690,195,398
se_76752259
stackoverflow
DATA_SCIENCE
Folium popup not working when rendering HTML
Folium popup not working when rendering HTML I want to do HTML formatting into a folium map popup. When I try to render html by using def format_popup_content(row) function then the map does not display. How do I format popup? This is what I have tried so far def format_popup_content(row): # Format the popup conte...
https://stackoverflow.com/questions/76752259/folium-popup-not-working-when-rendering-html
python, data-science, folium
1,690,183,853
se_59118472
stackoverflow
DATA_SCIENCE
What is the difference between metric and non-metric MDS for a beginner?
What is the difference between metric and non-metric MDS for a beginner? I am fairly new to data science and would like to know in simple words (like teaching your grandmother) what the difference between metric and non-metric Multidimensional scaling is. I have been googling for 2 days and watching different videos ...
https://stackoverflow.com/questions/59118472/what-is-the-difference-between-metric-and-non-metric-mds-for-a-beginner
r, data-science, mds, multi-dimensional-scaling
1,575,134,159
se_41560177
stackoverflow
DATA_SCIENCE
Using cross_val_predict against test data set
Using cross_val_predict against test data set I'm confused about using cross_val_predict in a test data set. I created a simple Random Forest model and used cross_val_predict to make predictions: from sklearn.ensemble import RandomForestClassifier from sklearn.cross_validation import cross_val_predict, KFold lr = Ran...
https://stackoverflow.com/questions/41560177/using-cross-val-predict-against-test-data-set
python, machine-learning, scikit-learn, data-science
1,484,015,307
se_52423697
stackoverflow
DATA_SCIENCE
How to create multiple plots
How to create multiple plots I'm to Python and learning it by doing. I want to make two plots with matplotlib in Python. The second plot keeps the limits of first one. Wonder how I can change the limits of each next plot from previous. Any help, please. What is the recommended method? X1 = [80, 100, 120, 140, 160, 1...
https://stackoverflow.com/questions/52423697/how-to-create-multiple-plots
python, matplotlib, machine-learning, plot, data-science
1,537,441,520
se_76733035
stackoverflow
DATA_SCIENCE
Matplotlib: Plotting all columns on the x-axis and values on the y-axis grouped by a third variable
Matplotlib: Plotting all columns on the x-axis and values on the y-axis grouped by a third variable I have data that looks like this: group var1 var2 var3 0 0.6 0.001 0.11 1 -0.36 -0.007 -0.066481 I want to create a dot graph where the 3 different variables form the x-axis and the y-...
https://stackoverflow.com/questions/76733035/matplotlib-plotting-all-columns-on-the-x-axis-and-values-on-the-y-axis-grouped
python, pandas, matplotlib, plot, data-science
1,689,880,041
se_76712627
stackoverflow
DATA_SCIENCE
How to visualize the correlation of columns into regression alike charts?
How to visualize the correlation of columns into regression alike charts? Conditions I have columns named, Shopping_Satisfaction and Rating_Accuracy They both store a value of rating range from 1 to 5, as below import pandas as pd import seaborn as sns import matplotlib.pyplot as plt path = '/kaggle/input/amazon-cons...
https://stackoverflow.com/questions/76712627/how-to-visualize-the-correlation-of-columns-into-regression-alike-charts
python, python-3.x, regression, seaborn, data-science
1,689,682,159
se_76718445
stackoverflow
DATA_SCIENCE
Why can’t I use df.loc() within the drop() method?
Why can’t I use df.loc() within the drop() method? I’m just getting started on pandas and I was trying to delete a sequence of rows. In my data frame, the index is the province names. Since df.loc[‘NL’:’QC’] returns a list of rows, I thought I would feed that as an input to my drop function to specify which rows I wan...
https://stackoverflow.com/questions/76718445/why-can-t-i-use-df-loc-within-the-drop-method
python, pandas, dataframe, data-science
1,689,747,360
se_76465909
stackoverflow
DATA_SCIENCE
ValueError: Need 2 classes but I have 0
ValueError: Need 2 classes but I have 0 I need two classes but I have just one class so I got ValueError: For Logistic Regression to understand, I converted string data types to integer data type. While there are Abnormal and Normal string values in the Class column, I updated them to 1 and 0. When I tried to fit Logi...
https://stackoverflow.com/questions/76465909/valueerror-need-2-classes-but-i-have-0
python, dataframe, machine-learning, scikit-learn, data-science
1,686,665,935
se_76645320
stackoverflow
DATA_SCIENCE
8bit Quantization: Prediction outputs uncorrelated to underlying model
8bit Quantization: Prediction outputs uncorrelated to underlying model I quantized a basic TFLite regression model to int8 but the prediction output seems to be highly uncorrelated with the actual underlying model prior to quantizing it. All the code and steps taken to train and quantize the model are seen below to m...
https://stackoverflow.com/questions/76645320/8bit-quantization-prediction-outputs-uncorrelated-to-underlying-model
tensorflow, data-science, quantization, tflite, 8-bit
1,688,859,057
se_76704112
stackoverflow
DATA_SCIENCE
Python / Pandas: Shift entities of a row to the right (end)
Python / Pandas: Shift entities of a row to the right (end) I have the following data frame (number of "Date" columns can vary): Customer Date1 Date2 Date3 Date4 0 A 10 40.0 NaN 60.0 1 B 20 50.0 NaN NaN 2 C 30 NaN NaN NaN If there is a "NaN" in the last colu...
https://stackoverflow.com/questions/76704112/python-pandas-shift-entities-of-a-row-to-the-right-end
python, pandas, dataframe, data-science, shift
1,689,594,214
se_71119326
stackoverflow
DATA_SCIENCE
Getting Module not found error when trying to import sklearn
Getting Module not found error when trying to import sklearn I'm a windows user, I have been trying to use Jupyter-Notebook to perform operations that uses sklearn package. I have been running into module not found error even though I have it installed. I installed it using pip install sklearn The error I'm getting i...
https://stackoverflow.com/questions/71119326/getting-module-not-found-error-when-trying-to-import-sklearn
python, scikit-learn, data-science, jupyter, sklearn-pandas
1,644,880,280
se_76689953
stackoverflow
DATA_SCIENCE
How to calculate time differences without a date and only with times?
How to calculate time differences without a date and only with times? import pandas as pd stoptimes_df = pd.DataFrame({ 'trip_id': ['1', '1', '1', '2', '2', '2'], 'arrival_time': ["12:10:00", "12:20:00", "12:30:00", "27:32:00", "27:39:00", "27:45:00"], 'departure_time': ["12:10:00", "12:20:00", "12:30:00...
https://stackoverflow.com/questions/76689953/how-to-calculate-time-differences-without-a-date-and-only-with-times
python, pandas, dataframe, datetime, data-science
1,689,355,371
se_76686845
stackoverflow
DATA_SCIENCE
Why Azure Data Factory DataFlow is only processing one line per file?
Why Azure Data Factory DataFlow is only processing one line per file? I have configured a Dataflow in Azure Data Factory to process multiple files. The data in the files is in JSON format and contains multiple lines of content(array of objects). However, when the pipeline finishes running, the processed files only con...
https://stackoverflow.com/questions/76686845/why-azure-data-factory-dataflow-is-only-processing-one-line-per-file
azure, data-science, azure-data-factory
1,689,330,588
se_76674414
stackoverflow
DATA_SCIENCE
Segmentation with piecewise linear regression
Segmentation with piecewise linear regression I am willing to segment a sequence into n subsequences (n known) where my points in each subsequence should be similar in a way that a piecewise linear function could fit the points (minimize the distance in each subsequence and the overall sequence). I have tried the pack...
https://stackoverflow.com/questions/76674414/segmentation-with-piecewise-linear-regression
python, data-science, breakpoints, subsequence
1,689,195,619
se_76673270
stackoverflow
DATA_SCIENCE
Add a column in R and compute difference time
Add a column in R and compute difference time I have a data set with about 15 000 rows and ten columns. I want to create a new column " difrence" by using columns " ID" and "DATE" in my data set. The "ID" includes the identity number of people the ids are repetitive. How can I create a new column the for each person, ...
https://stackoverflow.com/questions/76673270/add-a-column-in-r-and-compute-difference-time
r, statistics, data-science
1,689,184,382
se_42844457
stackoverflow
DATA_SCIENCE
scikit-learn: applying an arbitary function as part of a pipeline
scikit-learn: applying an arbitary function as part of a pipeline I've just discovered the Pipeline feature of scikit-learn, and I find it very useful for testing different combinations of preprocessing steps before training my model. A pipeline is a chain of objects that implement the fit and transform methods. Now...
https://stackoverflow.com/questions/42844457/scikit-learn-applying-an-arbitary-function-as-part-of-a-pipeline
python, machine-learning, scikit-learn, data-science
1,489,697,158
se_76666696
stackoverflow
DATA_SCIENCE
How to simplify &quot;Percentage for each class&quot;
How to simplify &quot;Percentage for each class&quot; I have the famous titanic data set fr1 = pd.DataFrame({ "class": ["1", "2", "2"], "survived": [0, 1, 1]}) I need to get the percentage of people who survived for each class, so first I separate applying a mask, then I group fr2 = fr1[fr1["Survived"] == 0] fr2 = fr...
https://stackoverflow.com/questions/76666696/how-to-simplify-percentage-for-each-class
pandas, dataframe, numpy, data-science
1,689,126,650
se_76666416
stackoverflow
DATA_SCIENCE
How to simplify &quot;Get mean ages for women of every class&quot;
How to simplify &quot;Get mean ages for women of every class&quot; I have the famous titanic dataset, called fr1. The class column contains the following: 1, 2, 3 The gender column: male, female I want to obtain the mean ages for females for each class, I think It should be a simpler way to code the following, imagine...
https://stackoverflow.com/questions/76666416/how-to-simplify-get-mean-ages-for-women-of-every-class
pandas, dataframe, numpy, data-science
1,689,119,623
se_76653061
stackoverflow
DATA_SCIENCE
how can i add custom prompt template on ConversationalRetrievalChain
how can i add custom prompt template on ConversationalRetrievalChain qa = ConversationalRetrievalChain.from_llm(OpenAI(temperature=0.8,model_name='gpt-3.5-turbo-16k'),db.as_retriever(), memory=memory) creating a chatbot for replying in a document. I want add prompt to it that it must only reply from the document and ...
https://stackoverflow.com/questions/76653061/how-can-i-add-custom-prompt-template-on-conversationalretrievalchain
data-science, openai-api, langchain
1,688,986,842
se_76660184
stackoverflow
DATA_SCIENCE
Extracting/Removing/skipping Free Text from Json Files in Azure Data Factory
Extracting/Removing/skipping Free Text from Json Files in Azure Data Factory I am trying to do some source transformation in ADF where I have alot server logs in the following format: #PartnerName QA Server #ApplicationName T_GSPClient #AccountName DoNotModifyDMS #SDK desktop #ClientVersion 5.1.1894.3 #In...
https://stackoverflow.com/questions/76660184/extracting-removing-skipping-free-text-from-json-files-in-azure-data-factory
azure, data-science, azure-data-factory
1,689,065,374
se_76615437
stackoverflow
DATA_SCIENCE
Psycopg inserting only two rows on data being passed via for loop
Psycopg inserting only two rows on data being passed via for loop I'm using a function to insert data to a PostGIS table using psycopg. def shptoPosGIS(a,b,c): fieldRecord = """ insert into 'tablename' """ fieldValue = (a,b,c) db_cursor.execute(fieldRecord, fieldValue) db_connection.commit() for i in ran...
https://stackoverflow.com/questions/76615437/psycopg-inserting-only-two-rows-on-data-being-passed-via-for-loop
python, data-science, gis, postgis, psycopg2
1,688,499,121
se_76637605
stackoverflow
DATA_SCIENCE
How to remove specific fields from log files before transferring using Azure Data Factory Data Flows
How to remove specific fields from log files before transferring using Azure Data Factory Data Flows I am new to ADF but I have managed to do some activity. My problem statement is: I have log files generated by a server, and I need to transfer them to another location for further processing. However, before transferr...
https://stackoverflow.com/questions/76637605/how-to-remove-specific-fields-from-log-files-before-transferring-using-azure-dat
azure, data-science, azure-data-factory
1,688,738,149
se_63825309
stackoverflow
DATA_SCIENCE
How to get lab streaming layer to work in C#?
How to get lab streaming layer to work in C#? I have a device that records live data like eeg measurements. I want to send these data with a lab streaming layer (lsl). Unfortunately I'm unable to configure the lsl and get it to run. I'm not sure if I even copied the dll to the right places. What I did so far: downloa...
https://stackoverflow.com/questions/63825309/how-to-get-lab-streaming-layer-to-work-in-c
c#, shared-libraries, streaming, data-science, badimageformatexception
1,599,724,821
se_76643281
stackoverflow
DATA_SCIENCE
There is a problem in the encoding the string variable to float or integer in sklearn during pipeline building
There is a problem in the encoding the string variable to float or integer in sklearn during pipeline building I was building a pipeline in sklearn using the column transformer ,I was using the column transform for the encoding and the code runs well but during training it is showing error that "could not convert stri...
https://stackoverflow.com/questions/76643281/there-is-a-problem-in-the-encoding-the-string-variable-to-float-or-integer-in-sk
machine-learning, scikit-learn, data-science, pipeline, one-hot-encoding
1,688,824,440
se_76644039
stackoverflow
DATA_SCIENCE
How to merge columns with same value and add values together from different columns using python
How to merge columns with same value and add values together from different columns using python enter image description here Hi, I'm taking a data science course and not familiar with python. I was wondering if it is possible to merge the same years together and adding the global sales for each year togehter? after g...
https://stackoverflow.com/questions/76644039/how-to-merge-columns-with-same-value-and-add-values-together-from-different-colu
python, pandas, dataframe, data-science
1,688,835,463
se_76642129
stackoverflow
DATA_SCIENCE
Problem with login to a journal website with selenium
Problem with login to a journal website with selenium I ran this code to login into website of journals with my institutional access: import pandas as pd import requests from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support import...
https://stackoverflow.com/questions/76642129/problem-with-login-to-a-journal-website-with-selenium
python, selenium-webdriver, web-scraping, data-science
1,688,806,100
se_76640223
stackoverflow
DATA_SCIENCE
cookies and verification problem in scraping
cookies and verification problem in scraping After running this code as part of a project, in order to enter login screen : import pandas as pd import requests from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support import expected_...
https://stackoverflow.com/questions/76640223/cookies-and-verification-problem-in-scraping
python, selenium-webdriver, data-science, screen-scraping, data-mining
1,688,763,727
se_76632422
stackoverflow
DATA_SCIENCE
Clicking a link with selenium library
Clicking a link with selenium library I have a project scraping data from tandfonline which I have institutional access to. To get the data from each article I need to click the issue button each time with selenium library, which has a unique class or id. I tried this code: driver = webdriver.Chrome() driver.get(url) ...
https://stackoverflow.com/questions/76632422/clicking-a-link-with-selenium-library
python, selenium-webdriver, web-scraping, data-science, data-mining
1,688,676,124
se_76632984
stackoverflow
DATA_SCIENCE
How to convert Pandas Dataframe to the shape of a correlation matrix
How to convert Pandas Dataframe to the shape of a correlation matrix I have a pandas dataframe which looks vaguely like this: Out[130]: xvar yvar meanRsquared 0 filled_water precip 0.119730 1 filled_water snow 0.113214 2 filled_water ...
https://stackoverflow.com/questions/76632984/how-to-convert-pandas-dataframe-to-the-shape-of-a-correlation-matrix
python, pandas, dataframe, data-science, correlation
1,688,684,203
se_76631921
stackoverflow
DATA_SCIENCE
scraping data from articles(author name)
scraping data from articles(author name) as a part from a project, I tried to extract author name from a journal I have institutional access. I need to iterate over every journal in each issue. firstly, I tried to extract author name from the tag I thought is most suitable, but got an error. The code I ran: import req...
https://stackoverflow.com/questions/76631921/scraping-data-from-articlesauthor-name
python, selenium-chromedriver, data-science, screen-scraping
1,688,670,952
se_76463018
stackoverflow
DATA_SCIENCE
Fast estimation of lagged covariance
Fast estimation of lagged covariance I am working on a bigger function whose main bottleneck is the estimation of lagged covariance. I couldn't find any function, so I had to make my own: def crosscov(signal1, signal2): lags = numpy.arange(-signal1.size+1,signal1.size) signal1 = copy.deepcopy(pandas.Series(sig...
https://stackoverflow.com/questions/76463018/fast-estimation-of-lagged-covariance
python, python-3.x, statistics, data-science, signal-processing
1,686,644,837
se_76624813
stackoverflow
DATA_SCIENCE
How to avoid NaN values when I use frame[&#39;Colum&#39;].map(dict)
How to avoid NaN values when I use frame[&#39;Colum&#39;].map(dict) I have the following dataset frame1 Color Item Red Shirt White Shoes Yellow Shirt Green Shoes I want to set all the colors for Shoes item to be "Blue", I use map x = {"Shoes": "Blue"} fr1["Color"] = fr1["Item"].map(x) I expected t...
https://stackoverflow.com/questions/76624813/how-to-avoid-nan-values-when-i-use-framecolum-mapdict
pandas, dataframe, numpy, data-science
1,688,603,449
se_76621713
stackoverflow
DATA_SCIENCE
combine 2 df with a for loop to make projections
combine 2 df with a for loop to make projections I have 2 data frames, both with strings, dates, and numbers. df1 is data for 2020 and df2 is data for 2021-2025. I will use df2 (column H) as a growth rate on df1. I need to multiply all numbers of df1 (columns D, E, F) by df2 (H[i,]) for each year in df2, from 2021 to ...
https://stackoverflow.com/questions/76621713/combine-2-df-with-a-for-loop-to-make-projections
r, dataframe, data-science, projection
1,688,569,913
se_76109675
stackoverflow
DATA_SCIENCE
How can i create a &quot;fake&quot; dataset based on a real one?
How can i create a &quot;fake&quot; dataset based on a real one? I am in the process of creating a "fake" dataset. Let me explain, I already have a dataset (of course I tried to study its topology as much as possible. That is with a study of correlation as well as the relations of variables to variables). My question ...
https://stackoverflow.com/questions/76109675/how-can-i-create-a-fake-dataset-based-on-a-real-one
machine-learning, statistics, dataset, data-science
1,682,504,595
se_76607974
stackoverflow
DATA_SCIENCE
How can I filter outliers while keeping rows where the target variable is of a certain value?
How can I filter outliers while keeping rows where the target variable is of a certain value? I have a large dataset with 30 predictor variables and 1 target variable. The data was calculated to be very imbalanced, with 280,000 values showing false and 450 values true. I am trying to filter out the outliers based on t...
https://stackoverflow.com/questions/76607974/how-can-i-filter-outliers-while-keeping-rows-where-the-target-variable-is-of-a-c
pandas, dataframe, conditional-statements, data-science
1,688,416,886
se_58686979
stackoverflow
DATA_SCIENCE
I tried to run rasa shell i am getting ERROR asyncio Task exception was never retrieved future
I tried to run rasa shell i am getting ERROR asyncio Task exception was never retrieved future I am trying to develop simple chatbot using rasa framework when i run rasa shell to interact with chatbot ,it showing this error: ERROR asyncio - Task exception was never retrieved future: <Task finished coro=<RestInput...
https://stackoverflow.com/questions/58686979/i-tried-to-run-rasa-shell-i-am-getting-error-asyncio-task-exception-was-never-re
python, data-science
1,572,839,471
se_60630270
stackoverflow
DATA_SCIENCE
How to resolve &quot;OpenSlideUnsupportedFormatError&quot;?
How to resolve &quot;OpenSlideUnsupportedFormatError&quot;? I need to read a .ndpi format image using OpenSlide. However, it doesn't seem to be working and I'm receiving an error. I'm running this on google colab. import openslide import matplotlib.pyplot as plt import numpy as np import cv2 path = "/content/02_HER2...
https://stackoverflow.com/questions/60630270/how-to-resolve-openslideunsupportedformaterror
python, machine-learning, data-science, openslide
1,583,907,663
se_76606268
stackoverflow
DATA_SCIENCE
Converting data in JSON format to string format in python
Converting data in JSON format to string format in python I have a IMDB dataset. It has a feature 'geners' which contains data in the form of JSON (i guess so) and to cary out further analysis, i need to convert that to string or any other format. How can i do that? gener original_language [{'id': 35, 'name': ...
https://stackoverflow.com/questions/76606268/converting-data-in-json-format-to-string-format-in-python
python, dataframe, data-science
1,688,398,655
se_76606393
stackoverflow
DATA_SCIENCE
Selecting row with highest value based on two different columns
Selecting row with highest value based on two different columns I have a dataframe with 3 columns: I want to make a rule that if for a same city and same id, pick the maximum value and drop the row with lower value. eg: City ID Value London 1 12.45 Amsterdam 1 14.56 Paris 1 16.89 New York 1 23.86 Chica...
https://stackoverflow.com/questions/76606393/selecting-row-with-highest-value-based-on-two-different-columns
python, pandas, dataframe, numpy, data-science
1,688,399,756
se_76604183
stackoverflow
DATA_SCIENCE
How to prune a classification decision tree based on classification thresholds
How to prune a classification decision tree based on classification thresholds I'm using sklearn to try to train a binary classification decision tree to classify spam vs not spam. My classification threshold is 50% (i.e I'll flag it as Spam if I think there's a 50%+ chance that it is). Assume the classes aren't imbal...
https://stackoverflow.com/questions/76604183/how-to-prune-a-classification-decision-tree-based-on-classification-thresholds
scikit-learn, data-science, classification, decision-tree, pruning
1,688,382,638
se_76589137
stackoverflow
DATA_SCIENCE
Getting an error from hdbscan while importing bertopic
Getting an error from hdbscan while importing bertopic I'm trying to import bertopic but it gives the following error. I tried different versions and re create a new environment. But it's still same. I'm using Apple M2 Pro processor lib version BERTopic 0.15.0 HDBSCAN 0.8.29 umap-learn 0.5.3  TypeError...
https://stackoverflow.com/questions/76589137/getting-an-error-from-hdbscan-while-importing-bertopic
python, anaconda, data-science, topic-modeling
1,688,129,794
se_76595794
stackoverflow
DATA_SCIENCE
What happens while predicting using a model when preprocessing layer is inside the model itself?
What happens while predicting using a model when preprocessing layer is inside the model itself? While training if we apply preprocessing like horizontal flip inside the model itself won't it affect the data while its predicting? so whats a work around to this or will it not matter if the augmentations are done on pre...
https://stackoverflow.com/questions/76595794/what-happens-while-predicting-using-a-model-when-preprocessing-layer-is-inside-t
pandas, tensorflow, machine-learning, data-science, tensorflow-lite
1,688,231,911
se_76583637
stackoverflow
DATA_SCIENCE
Compare number in numpy array
Compare number in numpy array Suppose I have an array that stores a total of 800,000 integers of type 'int8'. I want to compare every pair of numbers in the array, and the result should be 1 if the numbers in those two positions are equal, and 0 if the numbers in those two positions are not equal. The results should b...
https://stackoverflow.com/questions/76583637/compare-number-in-numpy-array
arrays, algorithm, numpy, data-science
1,688,062,335
se_76528084
stackoverflow
DATA_SCIENCE
How to get company earning announcements data API?
How to get company earning announcements data API? I want to get real-time earning announcements data API. I tried yfinance but it doesn't work currently. So is there any other replacement API? Most of API need to pay money, But I just want to try for my personal projects so it's little pressured Does Yahoo Finance no...
https://stackoverflow.com/questions/76528084/how-to-get-company-earning-announcements-data-api
python, data-science, real-time, finance
1,687,396,612
se_72369489
stackoverflow
DATA_SCIENCE
Warning &quot;Automatic reindexing&quot; when applying IQR on the Pandas Dataset
Warning &quot;Automatic reindexing&quot; when applying IQR on the Pandas Dataset When I try to remove outliers from my dataset, I get this warning: Code def remout(df): Q1 = df.quantile(0.02) Q3 = df.quantile(0.98) IQR = Q3 - Q1 df = df[~((df < (Q1 - 1.5 * IQR)) |(df > (Q3 + 1.5 * IQR))).any(axis=1)] ...
https://stackoverflow.com/questions/72369489/warning-automatic-reindexing-when-applying-iqr-on-the-pandas-dataset
python, pandas, scikit-learn, data-science, sklearn-pandas
1,653,426,486
se_76560259
stackoverflow
DATA_SCIENCE
How do obtain the local minimum and maximum points of a stock using yfinance in python?
How do obtain the local minimum and maximum points of a stock using yfinance in python? I'am trying to predict if a stock is a buying point or a selling point using logistical regressio. In order to do this, I require the local minimum and maximum points of a stock. For example, Image from: https://finance.yahoo.com/...
https://stackoverflow.com/questions/76560259/how-do-obtain-the-local-minimum-and-maximum-points-of-a-stock-using-yfinance-in
python, database, data-science, finance, stock
1,687,813,782
se_74140761
stackoverflow
DATA_SCIENCE
Every movie is from 1970 what did I do wrong?
Every movie is from 1970 what did I do wrong? getDecade <- function(year) { case_when( year < 1900 ~ "1890s", year >= 1900 && year < 1910 ~ "1900s", year >= 1910 && year < 1920 ~ "1910s", year >= 1920 && year < 1930 ~ "1920s", year >= 1930 && year < 1940 ~ "1930s", year >= 1940 && year < 1950...
https://stackoverflow.com/questions/74140761/every-movie-is-from-1970-what-did-i-do-wrong
r, dataframe, function, data-science, case
1,666,272,783
se_65713063
stackoverflow
DATA_SCIENCE
Suggesting Multivariate Ratios with Bounds in Optuna
Suggesting Multivariate Ratios with Bounds in Optuna I'm currently working with Optuna and I'm trying to suggest ratios that are bounded by multiple variables. Specifically, I'm dealing with ratios X_1, X_2, ..., X_k that are bounded by ∑X_i = 1 and 0 <= X_i <= 1 for all i. Unfortunately, Optuna does not provide a Dir...
https://stackoverflow.com/questions/65713063/suggesting-multivariate-ratios-with-bounds-in-optuna
python, machine-learning, optimization, data-science, optuna
1,610,595,386
se_65148584
stackoverflow
DATA_SCIENCE
How to fit data with square wave in Python?
How to fit data with square wave in Python? I have the following data: Experimental data and ideal fitting function I have been trying to fit it with a sequence of square pulses which I define as: def f(x, x0, a, b, c): sq = a * np.ones_like(x) sq[(x>x0) * (x<x0+b)] = c sq[(x>x0+2*b) * (x<x0+3*b)] = c ...
https://stackoverflow.com/questions/65148584/how-to-fit-data-with-square-wave-in-python
python, data-science, physics, data-science-experience
1,607,105,165
se_76539887
stackoverflow
DATA_SCIENCE
Do clustering on dataset but don&#39;t divide items with the same label
Do clustering on dataset but don&#39;t divide items with the same label I have a dataset with 10k+ points. Some of the data is labeled into 100+ labels. The rest is to classify. I cannot classify the new data directly as the number of labels is too high and the result doesn't look good enough. So I want to learn clust...
https://stackoverflow.com/questions/76539887/do-clustering-on-dataset-but-dont-divide-items-with-the-same-label
python, machine-learning, data-science, cluster-analysis
1,687,521,457
se_76537670
stackoverflow
DATA_SCIENCE
I am trying to get top5 products from a list of products
I am trying to get top5 products from a list of products So i have a data like this Category subcategory crn product1 product2 product3 product4 product5 product6 product7 A X 1 1 1 1 1 1 1 1 A Y 1 1 1 1 1 1 1 1 A Z 1 1 1 1 1 1 1 1 B X 1 1 1 1 1 1 1 1 And i want to showcase output like this Cat...
https://stackoverflow.com/questions/76537670/i-am-trying-to-get-top5-products-from-a-list-of-products
python, pandas, dataframe, machine-learning, data-science
1,687,502,701
se_74379996
stackoverflow
DATA_SCIENCE
Plotly Dash, dynamically importing excel file and perform operation on dataframe and plotting the graph and download excel file and graph button click
Plotly Dash, dynamically importing excel file and perform operation on dataframe and plotting the graph and download excel file and graph button click I am creating simple dash app using plotly dash frame work when user dynamically inputs the excel file it takes the the input as excelfile and do some caliculation and ...
https://stackoverflow.com/questions/74379996/plotly-dash-dynamically-importing-excel-file-and-perform-operation-on-dataframe
python, html, pandas, data-science, plotly-dash
1,668,020,035
se_76534055
stackoverflow
DATA_SCIENCE
Label a certain x,y data point on a validation curve
Label a certain x,y data point on a validation curve valid1 = plot_validation_curve(rand_search.best_estimator_, X_train, y_train, cv=StratifiedKFold(n_splits=5), param_range=np.arange(2,100,2), param_name = 'max_depth', scoring='f1') I am using the plot_...
https://stackoverflow.com/questions/76534055/label-a-certain-x-y-data-point-on-a-validation-curve
scikit-learn, data-science, cross-validation
1,687,452,515
se_74994653
stackoverflow
DATA_SCIENCE
Why do I get wrong number of keys in loglikelihood dictionary. Expected: 9165. Got: 9161
Why do I get wrong number of keys in loglikelihood dictionary. Expected: 9165. Got: 9161 # Build the freqs dictionary for later uses freqs = count_tweets({}, train_x, train_y) # UNQ_C2 GRADED FUNCTION: train_naive_bayes def train_naive_bayes(freqs, train_x, train_y): ''' Input: freqs: dictionary from...
https://stackoverflow.com/questions/74994653/why-do-i-get-wrong-number-of-keys-in-loglikelihood-dictionary-expected-9165-g
python-3.x, data-science, artificial-intelligence, nlp-question-answering
1,672,755,835
se_76528548
stackoverflow
DATA_SCIENCE
How to convert the Non-Monday column to Monday in Pandas Dataframe
How to convert the Non-Monday column to Monday in Pandas Dataframe I want to write a function that if a date is Tue.Wed.Tur. then convert it as this week's Monday, if a date is Fri. Sat. Sun. then convert it as next week's Monday. If its a Monday, just leave as it is. The example input Dataframe is like this: Mod...
https://stackoverflow.com/questions/76528548/how-to-convert-the-non-monday-column-to-monday-in-pandas-dataframe
python, pandas, dataframe, datetime, data-science
1,687,406,840
se_76492815
stackoverflow
DATA_SCIENCE
template.serveable() not working as expected in Python panel
template.serveable() not working as expected in Python panel I have the four CSV files stored in local. Each corresponds to some store details which has ItemNumber, ItemName, ItemBrand, and ItemCost. I am using a Python panel to display the CSV files in a browser after converting the CSV as an interactive data frame. ...
https://stackoverflow.com/questions/76492815/template-serveable-not-working-as-expected-in-python-panel
pandas, web-applications, data-science, panel, hvplot
1,686,940,558
se_53556092
stackoverflow
DATA_SCIENCE
Numpy obtain dtype per column
Numpy obtain dtype per column I need to obtain the type for each column to properly preprocess it. Currently I do this via the following method: import pandas as pd # input is of type List[List[any]] # but has one type (int, float, str, bool) per column df = pd.DataFrame(input, columns=key_labels) column_types = ...
https://stackoverflow.com/questions/53556092/numpy-obtain-dtype-per-column
python, pandas, numpy, types, data-science
1,543,575,165
se_72676258
stackoverflow
DATA_SCIENCE
PixelLib not detecting objects properly
PixelLib not detecting objects properly libraries im using import pixellib from pixellib.instance import instance_segmentation import cv2 import matplotlib.pyplot as plt the script: segment_image = instance_segmentation() segment_image.load_model('mask_rcnn_coco.h5') segmask, output = segment_image.segmentImage("imag...
https://stackoverflow.com/questions/72676258/pixellib-not-detecting-objects-properly
image-processing, data-science, image-segmentation, feature-extraction, pixellib
1,655,636,195
se_76505802
stackoverflow
DATA_SCIENCE
Time column and DateTime Format (DateTime object vs String Object)
Time column and DateTime Format (DateTime object vs String Object) How can I change the time without turning it into a string object (which dt.strftime does)? Like if I want to turn (default time format and time object)%H:%M:%S into %I:%M:%S %p or turn %H:%M:99(Default under time column in csv file data) into %H:%M:00...
https://stackoverflow.com/questions/76505802/time-column-and-datetime-format-datetime-object-vs-string-object
python, data-science, amibroker
1,687,170,974
se_76502238
stackoverflow
DATA_SCIENCE
Combine two Pandas rows into one with duplicated columns for time series
Combine two Pandas rows into one with duplicated columns for time series I have the following problem that I am trying to solve. I have two Pandas Dataframe rows with the same columns: Column A Column B Cell 1 Cell 2 Cell 3 Cell 4 I want to combine both rows into one single row by appending the columns: ...
https://stackoverflow.com/questions/76502238/combine-two-pandas-rows-into-one-with-duplicated-columns-for-time-series
python, pandas, dataframe, data-science, data-manipulation
1,687,116,721
se_76469276
stackoverflow
DATA_SCIENCE
How do I combine my dataframes while iterating through rows and adding a new column everytime
How do I combine my dataframes while iterating through rows and adding a new column everytime I have a raw dataframe, similar to below: Original DF I have index text 0 i am happy today ... 1 i am confused because ... 2 i would love to do ... ... ... 1000000 i am exhausted about ... So I have to run...
https://stackoverflow.com/questions/76469276/how-do-i-combine-my-dataframes-while-iterating-through-rows-and-adding-a-new-col
python, pandas, dataframe, csv, data-science
1,686,698,667
se_76493683
stackoverflow
DATA_SCIENCE
How to fix unexpected KeyError while mapping DataFrame column value to dictionary within loop in Python?
How to fix unexpected KeyError while mapping DataFrame column value to dictionary within loop in Python? I'm trying to conduct a multivariate time series analysis using Facebook's Prophet library in Python. My goal is to predict the circumference of various muscles of an athlete over time. My data consists of measurem...
https://stackoverflow.com/questions/76493683/how-to-fix-unexpected-keyerror-while-mapping-dataframe-column-value-to-dictionar
python, dataframe, dictionary, data-science, facebook-prophet
1,686,951,056
se_76491187
stackoverflow
DATA_SCIENCE
How to increase pandas explode function performance?
How to increase pandas explode function performance? I have data as below in a dataframe FID SID_START SID_END 404915 1 3 and this should be expanded as below FID SID 404915 1 404915 2 404915 3 So I can group by SID to get the count I have around 480 million rows and I am using explode fun...
https://stackoverflow.com/questions/76491187/how-to-increase-pandas-explode-function-performance
python, pandas, dataframe, numpy, data-science
1,686,925,947
se_76488380
stackoverflow
DATA_SCIENCE
I am getting &quot;Key Error&quot; Exception in Python
I am getting &quot;Key Error&quot; Exception in Python Getting Key Error 0 in the following code where some_digit = X[0] import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt #import the dataset from sklearn.datasets import fetch_openml mnist = fetch_openml('mnist_784', version = 1) mnist.keys(...
https://stackoverflow.com/questions/76488380/i-am-getting-key-error-exception-in-python
python, arrays, pandas, image, data-science
1,686,904,553
se_76485562
stackoverflow
DATA_SCIENCE
How does one create a pandas column (binary) based on whether or not another column contains dates
How does one create a pandas column (binary) based on whether or not another column contains dates I am analyzing customer churn. My dataset contains years of customers that have stayed or left. I need to create a ['CHURN_FLAG'] column based on whether or not there is a date in the ['CHURN_DATE'] column. If there is a...
https://stackoverflow.com/questions/76485562/how-does-one-create-a-pandas-column-binary-based-on-whether-or-not-another-col
python, pandas, dataframe, data-science
1,686,863,684
se_76479625
stackoverflow
DATA_SCIENCE
Pandas groupby(pd.Grouper) is throwing error for datetime but im running it on a datetime object
Pandas groupby(pd.Grouper) is throwing error for datetime but im running it on a datetime object I'm using pandas in python, and am trying to group a set of dates by month, and determine the highest value in the dates_and_grades["Grade_Values"] column for each month. I wrote the following code attempting to do this: d...
https://stackoverflow.com/questions/76479625/pandas-groupbypd-grouper-is-throwing-error-for-datetime-but-im-running-it-on-a
python, pandas, dataframe, datetime, data-science
1,686,809,998