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_26483254
stackoverflow
DATA_SCIENCE
Python pandas insert list into a cell
Python pandas insert list into a cell I have a list 'abc' and a dataframe 'df': abc = ['foo', 'bar'] df = A B 0 12 NaN 1 23 NaN I want to insert the list into cell 1B, so I want this result: A B 0 12 NaN 1 23 ['foo', 'bar'] Ho can I do that? 1) If I use this: df.ix[1,'B'] = abc I get the fo...
https://stackoverflow.com/questions/26483254/python-pandas-insert-list-into-a-cell
python, list, pandas, insert, dataframe
1,413,883,585
se_79767425
stackoverflow
DATA_SCIENCE
Merging Pandas dataframes on column combinations
Merging Pandas dataframes on column combinations Scenario: I am trying to merge 2 pandas dataframes. DF1 has the bulk data, and DF2 is a sort of mapping. Based on the combination of the values of 3 different columns, I want to put a column from DF2 into DF1. Data sample (just a snippet of both dfs): DF1: +-------+----...
https://stackoverflow.com/questions/79767425/merging-pandas-dataframes-on-column-combinations
python, pandas, dataframe
1,758,117,369
se_69326639
stackoverflow
DATA_SCIENCE
SKLearn warning "valid feature names" in version 1.0
SKLearn warning "valid feature names" in version 1.0 I'm getting the following warning after upgrading to version 1.0 of scikit-learn: UserWarning: X does not have valid feature names, but IsolationForest was fitted with feature name I cannot find in the docs on what is a "valid feature name". How do I dea...
https://stackoverflow.com/questions/69326639/sklearn-warning-valid-feature-names-in-version-1-0
python-3.x, pandas, scikit-learn
1,632,576,799
se_66521503
stackoverflow
DATA_SCIENCE
How to create an empty dataframe
How to create an empty dataframe I saw this line of code from a book, what does that mean? After that, I print portfolio, it is just a underscore, but it is not empty DataFrame. portfolio = portfolio = pd.DataFrame()
https://stackoverflow.com/questions/66521503/how-to-create-an-empty-dataframe
python, pandas
1,615,151,758
se_79767341
stackoverflow
DATA_SCIENCE
ModuleNotFoundError: No module named 'pandas._config'
ModuleNotFoundError: No module named 'pandas._config' I am trying to run Python project with Pandas as a dependency, installed with Poetry. name : pandas version : 2.3.2 ...
https://stackoverflow.com/questions/79767341/modulenotfounderror-no-module-named-pandas-config
pandas
1,758,113,295
se_14898574
stackoverflow
DATA_SCIENCE
Resample intraday pandas DataFrame without add new days
Resample intraday pandas DataFrame without add new days I want to downsample some intraday data without adding in new days df.resample('30Min') Will add weekends etc which is undesirable. Is there anyway around this?
https://stackoverflow.com/questions/14898574/resample-intraday-pandas-dataframe-without-add-new-days
python, pandas, time-series
1,360,944,180
se_79766547
stackoverflow
DATA_SCIENCE
Is there a function to filter a dataframe by a column value and produce a dictionary?
Is there a function to filter a dataframe by a column value and produce a dictionary? In python pandas, I'm wondering if there is a builtin function that does the same as df_to_dict below. Speed is of the essence, as my dataframe can have thousands of rows. Basically return a dictionary with keys being the set of valu...
https://stackoverflow.com/questions/79766547/is-there-a-function-to-filter-a-dataframe-by-a-column-value-and-produce-a-dictio
python, pandas, dataframe
1,758,045,903
se_60870620
stackoverflow
DATA_SCIENCE
SQLAlchemy engine.connect() fails for Snowflake using keypair authentication
SQLAlchemy engine.connect() fails for Snowflake using keypair authentication My goal is to be able to write a pandas dataframe to Snowflake using the to_sql() function. I am able to successfuly query from Snowflake using read_sql() with no problems. It appears that to_sql() requires a slightly different configuration ...
https://stackoverflow.com/questions/60870620/sqlalchemy-engine-connect-fails-for-snowflake-using-keypair-authentication
python, pandas, sqlalchemy, snowflake-cloud-data-platform
1,585,236,351
se_75945585
stackoverflow
DATA_SCIENCE
Merge the duplicate rows on multiple column?
Merge the duplicate rows on multiple column? Sample Input: DID FIRST NAME MIDDLE NAME LAST NAME STREET CITY STATE ZIP DOB PIN TIN CRA0012347129 John JR Nan Doe Nan Nan Nan 1124.0 02-07-2020 12345678998765432 268869162.0 CRA0012347152 John Nan ...
https://stackoverflow.com/questions/75945585/merge-the-duplicate-rows-on-multiple-column
python, pandas, machine-learning, data-science, data-manipulation
1,680,751,627
se_72385900
stackoverflow
DATA_SCIENCE
OptionError: "No such keys(s): 'io.excel.zip.reader'"
OptionError: "No such keys(s): 'io.excel.zip.reader'" I am trying to merge multiple .xlsx.zip files into one but this error keeps on coming up. Now, firstly I am using glob.glob for selecting the files (works perfectly) stock_files = glob.glob('*/*.xlsx.zip', recursive=True) stock_files And then whe...
https://stackoverflow.com/questions/72385900/optionerror-no-such-keyss-io-excel-zip-reader
python, pandas
1,653,530,402
se_45300428
stackoverflow
DATA_SCIENCE
Sorting pivot table (multi index)
Sorting pivot table (multi index) I'm trying to sort a pivot table's values in descending order after putting two "row labels" (Excel term) on the pivot. sample data: x = pd.DataFrame({'col1':['a','a','b','c','c', 'a','b','c', 'a','b','c'], 'col2':[ 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3], ...
https://stackoverflow.com/questions/45300428/sorting-pivot-table-multi-index
python, pandas, numpy, sorting, pivot-table
1,500,978,052
se_61888816
stackoverflow
DATA_SCIENCE
How to plot a bar plot of 2 categorical columns using matplotlib or seaborn
How to plot a bar plot of 2 categorical columns using matplotlib or seaborn This might be a simple task but I am new to plotting in python and is struggling to convert logic into code. I have 2 columns like below. 0 mean not churned and 1 means churned. gender is an object column and churned is a category column gend...
https://stackoverflow.com/questions/61888816/how-to-plot-a-bar-plot-of-2-categorical-columns-using-matplotlib-or-seaborn
python, pandas, matplotlib, plot, seaborn
1,589,884,125
se_31295740
stackoverflow
DATA_SCIENCE
How to replace None only with empty string using pandas?
How to replace None only with empty string using pandas? the code below generates a df: import pandas as pd from datetime import datetime as dt import numpy as np dates = [dt(2014, 1, 2, 2), dt(2014, 1, 2, 3), dt(2014, 1, 2, 4), None] strings1 = ['A', 'B',None, 'C'] strings2 = [None, 'B','C', 'C'] strings3 = ['A', '...
https://stackoverflow.com/questions/31295740/how-to-replace-none-only-with-empty-string-using-pandas
python, pandas
1,436,365,876
se_62519635
stackoverflow
DATA_SCIENCE
How to change Pandas dataframe column name from 'NaN' to something else
How to change Pandas dataframe column name from 'NaN' to something else I have tried to string the column names and then change them -- no success, it left it NaN: data.rename(columns=str).rename(columns={'NaN':'Tip Analiza','NaN':'Limite' }, inplace=True) I tried to use the in function to replace NaN-- no su...
https://stackoverflow.com/questions/62519635/how-to-change-pandas-dataframe-column-name-from-nan-to-something-else
python, pandas, rename
1,592,845,102
se_64048169
stackoverflow
DATA_SCIENCE
How do I find the mode of a column of categorical data?
How do I find the mode of a column of categorical data? I want to find the most repetitive value (which is the mode) of a column of categorical data and fill the blank cells with this value. "Embarked" column has only three values: S,Q,C When I try to calculate mean and median it gives an error already, because its no...
https://stackoverflow.com/questions/64048169/how-do-i-find-the-mode-of-a-column-of-categorical-data
python, pandas, dataframe
1,600,956,209
se_23330654
stackoverflow
DATA_SCIENCE
Update a dataframe in pandas while iterating row by row
Update a dataframe in pandas while iterating row by row I have a pandas data frame that looks like this (its a pretty big one) date exer exp ifor mat 1092 2014-03-17 American M 528.205 2014-04-19 1093 2014-03-17 American M 528.205 2014-04-19 1094 2014-03-17 American M ...
https://stackoverflow.com/questions/23330654/update-a-dataframe-in-pandas-while-iterating-row-by-row
python, pandas, updates, dataframe
1,398,644,389
se_79701584
stackoverflow
DATA_SCIENCE
How can I remove the brackets and parentheses at the end of words?
How can I remove the brackets and parentheses at the end of words? My task is to parse the protein names by removing the brackets and parentheses in the row. In short, I want to retain the words in front of any parentheses and brackets. Note that I need to keep symbols in the main words like H(+)/Cl(-) exchange transp...
https://stackoverflow.com/questions/79701584/how-can-i-remove-the-brackets-and-parentheses-at-the-end-of-words
python, pandas, regex
1,752,556,455
se_79707491
stackoverflow
DATA_SCIENCE
Can't make candle chart due to some error with mpf.plot
Can't make candle chart due to some error with mpf.plot import pandas as pd import yfinance as yf import mplfinance as mpf df = yf.download('AMZN', start='2020-01-01', end='2025-07-31') print(df) mpf.plot(df['2020-01-01':'2020-06-01'], type='candle', volume=True) This is the code I have written. This is the outp...
https://stackoverflow.com/questions/79707491/cant-make-candle-chart-due-to-some-error-with-mpf-plot
python, pandas, dataframe, candlestick-chart, mplfinance
1,752,950,271
se_58101126
stackoverflow
DATA_SCIENCE
Using Scikit-Learn OneHotEncoder with a Pandas DataFrame
Using Scikit-Learn OneHotEncoder with a Pandas DataFrame I'm trying to replace a column within a Pandas DataFrame containing strings into a one-hot encoded equivalent using Scikit-Learn's OneHotEncoder. My code below doesn't work: from sklearn.preprocessing import OneHotEncoder # data is a Pandas DataFrame jobs_enco...
https://stackoverflow.com/questions/58101126/using-scikit-learn-onehotencoder-with-a-pandas-dataframe
python, pandas, machine-learning, scikit-learn, one-hot-encoding
1,569,422,836
se_9621362
stackoverflow
DATA_SCIENCE
How do I compute a weighted moving average using pandas?
How do I compute a weighted moving average using pandas? Using pandas, I can compute a simple moving average (SMA) using pandas.stats.moments.rolling_mean exponential moving average (EMA) using pandas.stats.moments.ewma But how do I compute a weighted moving average (WMA), as described on Wikipedia_, using pandas? I...
https://stackoverflow.com/questions/9621362/how-do-i-compute-a-weighted-moving-average-using-pandas
python, pandas
1,331,224,950
se_79761269
stackoverflow
DATA_SCIENCE
Best way to assign a scalar to a new DataFrame column with a specific dtype
Best way to assign a scalar to a new DataFrame column with a specific dtype I am writing a routine to load a large dataset into a Pandas DataFrame from a bespoke text format. As part of this process, I need to add new columns to a DataFrame. Sometimes I need to broadcast a scalar value into the whole column, and I use...
https://stackoverflow.com/questions/79761269/best-way-to-assign-a-scalar-to-a-new-dataframe-column-with-a-specific-dtype
python, pandas, dataframe, numpy, series
1,757,536,085
se_79762124
stackoverflow
DATA_SCIENCE
How do I find top Values based on different columns?
How do I find top Values based on different columns? i am using a dataset of video game sales and i am trying to make a pie chart of the top 10 publishers based on global_sales right now i have: data['Publisher'].value_counts().head(10).plot.pie(autopct='%1.1f%%', startangle=90) but im pretty sure that its only addin...
https://stackoverflow.com/questions/79762124/how-do-i-find-top-values-based-on-different-columns
python, pandas, dataframe, matplotlib
1,757,604,861
se_61009092
stackoverflow
DATA_SCIENCE
AttributeError: partially initialized module 'pandas' has no attribute 'DataFrame'
AttributeError: partially initialized module 'pandas' has no attribute 'DataFrame' i want to run this code but i can't and received this error. also i downloaded pandas package. import pandas data = { "Day": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "Visitors": [18, 26, 18, 18, 9, 9, 20, 30, 16, 24], ...
https://stackoverflow.com/questions/61009092/attributeerror-partially-initialized-module-pandas-has-no-attribute-datafram
python, pandas, attributeerror
1,585,907,080
se_78475583
stackoverflow
DATA_SCIENCE
`pandas.tseries.offsets` hard to predict result
`pandas.tseries.offsets` hard to predict result I found it really hard to predict the results produced by pandas.tseries.offsets, especially when n==0. Below is an example with MonthEnd and MonthBegin. import pandas as pd from pandas.tseries.offsets import MonthEnd, MonthBegin date_ = pd.to_datetime('20240601') print...
https://stackoverflow.com/questions/78475583/pandas-tseries-offsets-hard-to-predict-result
python, pandas, pd.offsets
1,715,657,619
se_79762507
stackoverflow
DATA_SCIENCE
Plotly chloropleth of India not showing states properly (too small)
Plotly chloropleth of India not showing states properly (too small) I am trying to create a choropleth of India that shows railway accident data. When I try to make run it a choropleth is created, but the states of India are too small and do not reflect their real life sizes. Here is a picture of the incorrect choropl...
https://stackoverflow.com/questions/79762507/plotly-chloropleth-of-india-not-showing-states-properly-too-small
python, pandas, plotly, geojson, choropleth
1,757,646,625
se_79433102
stackoverflow
DATA_SCIENCE
get data from dataframe with pandas module
get data from dataframe with pandas module import pandas data = pandas.read_csv("databooks.csv") print(data.titulo) All ok , but: print(data.autor) KeyError: 'autor' autor exists and is well written I expected the autor column from data. This column is showed when: print(data)
https://stackoverflow.com/questions/79433102/get-data-from-dataframe-with-pandas-module
python, pandas, csv, keyerror
1,739,364,334
se_78291000
stackoverflow
DATA_SCIENCE
pandas/pyarrow ArrowTypeError: Unable to merge: Field on handcrafted partitioned parquet
pandas/pyarrow ArrowTypeError: Unable to merge: Field on handcrafted partitioned parquet I read the parquet file directly pd.read_parquet(r'C:\Datasets\cn_data\dm\qmt\wqa_mfeatures\30m\year=2020\month=11\data.parquet') No error will be reported. But when I read the directory: pd.read_parquet(r'C:\Datasets\cn_data\dm\...
https://stackoverflow.com/questions/78291000/pandas-pyarrow-arrowtypeerror-unable-to-merge-field-on-handcrafted-partitioned
python, pandas, pyarrow
1,712,562,789
se_79761569
stackoverflow
DATA_SCIENCE
How to retrieve pandas dataframe agent-generated file?
How to retrieve pandas dataframe agent-generated file? I have a pandas dataframe agent deployed in an Azure FastAPI app service. agent = create_pandas_dataframe_agent( llm, df, verbose=True, prefix=prefix, agent_type=AgentType.OPENAI_FUNCTIONS, ...
https://stackoverflow.com/questions/79761569/how-to-retrieve-pandas-dataframe-agent-generated-file
pandas, dataframe, file, agent, generated
1,757,574,309
se_76007024
stackoverflow
DATA_SCIENCE
Why does my same unchanged webscraping code keep showing different things each time I run it?
Why does my same unchanged webscraping code keep showing different things each time I run it? This is my code that web scrapes multiple tables with horse data from this website. "https://racing.hkjc.com/racing/information/English/raCing/RaceCard.aspx?RaceDate=2023/04/15&Racecourse=ST&RaceNo=1" What its supposed to do ...
https://stackoverflow.com/questions/76007024/why-does-my-same-unchanged-webscraping-code-keep-showing-different-things-each-t
python, pandas, web-scraping, beautifulsoup, playwright-python
1,681,398,407
se_79761149
stackoverflow
DATA_SCIENCE
How to find columns not matching in Pandas Merge?
How to find columns not matching in Pandas Merge? I'm performing data validation in Python using the Pandas module. I have two datasets to compare source and target data for expected values. I've successfully merged two dataframes using pd.merge and need to identify the columns causing the merge to be left or right on...
https://stackoverflow.com/questions/79761149/how-to-find-columns-not-matching-in-pandas-merge
python, pandas, dataframe, merge
1,757,527,028
se_66375262
stackoverflow
DATA_SCIENCE
specify number of spaces between pandas DataFrame columns when printing
specify number of spaces between pandas DataFrame columns when printing When you print a pandas DataFrame, which calls DataFrame.to_string, it normally inserts a minimum of 2 spaces between the columns. For example, this code import pandas as pd df = pd.DataFrame( { "c1" : ("a", "bb", "ccc", "dddd", "eeeeee"), ...
https://stackoverflow.com/questions/66375262/specify-number-of-spaces-between-pandas-dataframe-columns-when-printing
python, pandas, dataframe, tostring, spaces
1,614,281,528
se_79761270
stackoverflow
DATA_SCIENCE
PVLib Soiling Models: Discrepancy between Kimber and HSU Models
PVLib Soiling Models: Discrepancy between Kimber and HSU Models I am using PVLib modeling to estimate soiling for my project. I am checking both HSU and Kimber models to compare and identify the best result. The problem is, I would expect outputs to be somewhat similar, but there are huge discrepancies between the two...
https://stackoverflow.com/questions/79761270/pvlib-soiling-models-discrepancy-between-kimber-and-hsu-models
python, pandas, pvlib, solar
1,757,536,168
se_71516740
stackoverflow
DATA_SCIENCE
How to convert object data type into int64 in python?
How to convert object data type into int64 in python? I have a dataset and it has one variable as object data type, i have to convert it to int64 type.
https://stackoverflow.com/questions/71516740/how-to-convert-object-data-type-into-int64-in-python
python, pandas, int64
1,647,538,573
se_53256091
stackoverflow
DATA_SCIENCE
How can I fix "Error tokenizing data" on pandas csv reader?
How can I fix "Error tokenizing data" on pandas csv reader? I'm trying to read a csv file with pandas. This file actually has only one row but it causes an error whenever I try to read it. Something wrong seems happening in line 8 but I could hardly find the 8th line since there's clearly only one row on it....
https://stackoverflow.com/questions/53256091/how-can-i-fix-error-tokenizing-data-on-pandas-csv-reader
python, pandas, csv, tokenize
1,541,997,946
se_61135890
stackoverflow
DATA_SCIENCE
For each NAME, calculate the average SNOW for each month
For each NAME, calculate the average SNOW for each month import pandas as pd import numpy as np # Show the specified columns and save it to a new file col_list= ["STATION", "NAME", "DATE", "AWND", "SNOW"] df = pd.read_csv('Data.csv', usecols=col_list) df.to_csv('filteredData.csv') df['year'] = pd.DatetimeIndex(df['D...
https://stackoverflow.com/questions/61135890/for-each-name-calculate-the-average-snow-for-each-month
python, pandas, csv
1,586,504,233
se_79745115
stackoverflow
DATA_SCIENCE
How do you remove already filtered category values from DataFrames from plots and pivot tables?
How do you remove already filtered category values from DataFrames from plots and pivot tables? My dataframes show video game titles, platforms, year of release, revenue, etc. I have filtered the original dataframe "df_samplegames", which has 29 different platforms (type category), into a new dataframe "df_finalgames"...
https://stackoverflow.com/questions/79745115/how-do-you-remove-already-filtered-category-values-from-dataframes-from-plots-an
python, pandas, dataframe, categories, isin
1,756,062,626
se_79735244
stackoverflow
DATA_SCIENCE
How to scrape a website that has <span class="ellipsis">…</span> in between number on a dynamic table with Selenium Python
How to scrape a website that has <span class="ellipsis">…</span> in between number on a dynamic table with Selenium Python I am trying to scrape dividend data for the stock "Vale" on the site https://investidor10.com.br/acoes/vale3/. The dividend table has 8 buttons (1, 2, 3, ..., 8) and "Next" a...
https://stackoverflow.com/questions/79735244/how-to-scrape-a-website-that-has-span-class-ellipsis-span-in-between-numb
python, pandas, dataframe, selenium-webdriver, pagination
1,755,165,892
se_79725440
stackoverflow
DATA_SCIENCE
Convert (many) integer-valued rows into binary indicator columns using Pandas
Convert (many) integer-valued rows into binary indicator columns using Pandas I am working on a task that seems to me a little like one-hot encoding, but notably different. What I want to do is take a row of integers from a Pandas DataFrame and produce a binary column with 1's at the index locations specified by the i...
https://stackoverflow.com/questions/79725440/convert-many-integer-valued-rows-into-binary-indicator-columns-using-pandas
python, pandas, dataframe
1,754,346,717
se_73684178
stackoverflow
DATA_SCIENCE
Converting pandas DataFrame to JSON array gives "only size-1 arrays can be converted to Python scalars" error
Converting pandas DataFrame to JSON array gives "only size-1 arrays can be converted to Python scalars" error I'm trying to read a CSV file and convert its contents to a JSON array, but I'm getting the error: "only size-1 arrays can be converted to Python scalars" The csv file contents are 4.4.4.4 5.5....
https://stackoverflow.com/questions/73684178/converting-pandas-dataframe-to-json-array-gives-only-size-1-arrays-can-be-conve
python, pandas, dataframe
1,662,952,950
se_79759475
stackoverflow
DATA_SCIENCE
Extract values from each row corresponding to a column and add it in a single row
Extract values from each row corresponding to a column and add it in a single row I have a dataframe with multiple rows that can be combined to a single row. I'm not sure how to do it. Input DataFrame: Emp# Name Week1 Week2 Week3 Week4 1 mary 45 0 0 0 1 mary 0 45 0 0 1 mary 0 0 63 0 1 mary 0 0 0 45 2 jo...
https://stackoverflow.com/questions/79759475/extract-values-from-each-row-corresponding-to-a-column-and-add-it-in-a-single-ro
python, pandas
1,757,387,923
se_79732371
stackoverflow
DATA_SCIENCE
Column level alignment in pandas DataFrame printing
Column level alignment in pandas DataFrame printing When a pandas DataFrame is printed, the MultiIndex column levels are aligned with the 1st (left most) column instead of the last (right most) column: import numpy as np import pandas as pd df = pd.DataFrame( [np.arange(6), np.arange(6)+5], columns=pd.MultiIn...
https://stackoverflow.com/questions/79732371/column-level-alignment-in-pandas-dataframe-printing
python, pandas, dataframe, printing
1,754,936,790
se_79759016
stackoverflow
DATA_SCIENCE
Change the decimal value of each value in each column to 0.5 while maintaining the same leading integer python pandas
Change the decimal value of each value in each column to 0.5 while maintaining the same leading integer python pandas CONTEXT I am NOT trying to round to the nearest 0.5. I know there are questions on here that address that. Rather, I am trying to change the decimal value of each value in each row to 0.5 while maintai...
https://stackoverflow.com/questions/79759016/change-the-decimal-value-of-each-value-in-each-column-to-0-5-while-maintaining-t
python, pandas, dataframe, apply, rounding
1,757,341,255
se_78231969
stackoverflow
DATA_SCIENCE
Applying group by then condition
Applying group by then condition How can the value of 'same_month=yes' be updated for entries grouped by "code" when the "Date" is identical? below are examples of the data frame import pandas as pd df = pd.DataFrame([[1,'2023-01-02 00:00:00','01','2023',''], [2,'2023-01-02 00:00:00','01','2023',''...
https://stackoverflow.com/questions/78231969/applying-group-by-then-condition
python, pandas
1,711,545,154
se_30039334
stackoverflow
DATA_SCIENCE
Sum of products of pairs in a list
Sum of products of pairs in a list This is the problem I have. Given a list xList = [9, 13, 10, 5, 3] I would like to calculate for sum of each element multiplied by subsequent elements sum([9*13, 9*10, 9*5 , 9*3]) + sum([13*10, 13*5, 13*3]) + sum([10*5, 10*3]) + sum ([5*3]) in this case the answer is 608. ...
https://stackoverflow.com/questions/30039334/sum-of-products-of-pairs-in-a-list
python, numpy, pandas, python-itertools
1,430,771,145
se_79381686
stackoverflow
DATA_SCIENCE
ImportError: Install adlfs to access Azure Datalake Gen2 and Azure Blob Storage even after adlsf is installed
ImportError: Install adlfs to access Azure Datalake Gen2 and Azure Blob Storage even after adlsf is installed I have an azure function with code below: storage_account_url = f"{self.datalake_settings.xx}/{parquet_folder_path}/{file_name}.parquet" storage_options = { "account_name": self.datalake_settings.xx, "...
https://stackoverflow.com/questions/79381686/importerror-install-adlfs-to-access-azure-datalake-gen2-and-azure-blob-storage
python, pandas, dataframe, azure-functions, azure-data-lake
1,737,646,722
se_69937019
stackoverflow
DATA_SCIENCE
Pandas .to_csv() gives "No engine for filetype: 'csv'"
Pandas .to_csv() gives "No engine for filetype: 'csv'" Basically, the title. The pd.Dataframe.to_csv() method works fine on my machine outside of the app code, but if I try to run it in a pyqt5 gui, I get the following error: No engine for filetype: 'csv'. Below is the function that causes the error....
https://stackoverflow.com/questions/69937019/pandas-to-csv-gives-no-engine-for-filetype-csv
python, pandas
1,636,681,565
se_23797491
stackoverflow
DATA_SCIENCE
Parse_dates in Pandas
Parse_dates in Pandas The following code can't parse my date column into dates from csv file. data = pd.read_csv('c:/data.csv', parse_dates=True, keep_date_col=True) or data = pd.read_csv('c:/data.csv', parse_dates=[0]) data is like following date value 30MAR1990 140000 30JUN1990 30000 30SEP1990 ...
https://stackoverflow.com/questions/23797491/parse-dates-in-pandas
python, datetime, pandas
1,400,730,385
se_79758014
stackoverflow
DATA_SCIENCE
Plot datetimeindex.time data in Mathplotlib
Plot datetimeindex.time data in Mathplotlib I did find a couple of threads related to similar topics, but the use case is always slightly different, as the goal often is just to format the x-axis of a plot or similar. So I am opening this new thread and hope someone has a good idea. The starting point for my issue is ...
https://stackoverflow.com/questions/79758014/plot-datetimeindex-time-data-in-mathplotlib
pandas, matplotlib
1,757,233,681
se_47424345
stackoverflow
DATA_SCIENCE
Pandas- Dividing a column by another column conditional on if values are greater than 0?
Pandas- Dividing a column by another column conditional on if values are greater than 0? I have a pandas dataframe that contains dates, items, and 2 values. All I'm looking to do is output another column that is the product of column A / column B if column B is greater than 0, and 0 if column B is equal to 0. dat...
https://stackoverflow.com/questions/47424345/pandas-dividing-a-column-by-another-column-conditional-on-if-values-are-greater
python, pandas, if-statement, dataframe
1,511,306,377
se_71419405
stackoverflow
DATA_SCIENCE
Reading and handling many small CSV-s to concatenate one large Dataframe
Reading and handling many small CSV-s to concatenate one large Dataframe I have two folders each contains about 8,000 small csv files. One with an aggregated size of around 2GB and another with aggregated size of around 200GB. These files are stored like this to better update them in a daily basis. However, when I con...
https://stackoverflow.com/questions/71419405/reading-and-handling-many-small-csv-s-to-concatenate-one-large-dataframe
pandas, database, multithreading, dataframe, parallel-processing
1,646,891,501
se_58801176
stackoverflow
DATA_SCIENCE
Display pandas dataframe with larger font in jupyter notebook
Display pandas dataframe with larger font in jupyter notebook I have a small-shaped (5 rows, 3 columns) dataframe which I can display by calling df in jupyter cell. I would like to enlarge (font size) this output for presentation purpose. Is it possible?
https://stackoverflow.com/questions/58801176/display-pandas-dataframe-with-larger-font-in-jupyter-notebook
python, pandas, dataframe, jupyter, pandas-styles
1,573,474,609
se_69101233
stackoverflow
DATA_SCIENCE
Using DateFormatter resets starting date to 1970
Using DateFormatter resets starting date to 1970 I have a dataframe where the index is the first date of each month and the size column is the frequency for that month, e.g. Using .index on the dataframe confirms the type of the index is DatetimeIndex: DatetimeIndex(['2006-12-01', ...], dtype='datetime6...
https://stackoverflow.com/questions/69101233/using-dateformatter-resets-starting-date-to-1970
python, pandas, dataframe, datetime, matplotlib
1,631,096,327
se_60818048
stackoverflow
DATA_SCIENCE
How to explode the column value without duplicating the other columns values in panda dataframe?
How to explode the column value without duplicating the other columns values in panda dataframe? I have df like this: id ColumnA ColumnB ColumnC 1 Audi_BMW_VW BMW_Audi VW 2 VW Audi Audi_BMW_VW I want to explode the columns based ...
https://stackoverflow.com/questions/60818048/how-to-explode-the-column-value-without-duplicating-the-other-columns-values-in
python, pandas
1,584,982,416
se_60981582
stackoverflow
DATA_SCIENCE
Using conditions in pandas value_counts()
Using conditions in pandas value_counts() When applying conditions based on value_counts() to an dataframe, a "boolean dataframe" is obtained, as in the example below: The csv I am using for the example is this one. import pandas as pd sal = pd.read_csv("Salaries.csv") sal[sal["Year"] == 2013]["JobTitle"].value_co...
https://stackoverflow.com/questions/60981582/using-conditions-in-pandas-value-counts
python, pandas
1,585,781,701
se_79756594
stackoverflow
DATA_SCIENCE
How do I capture missing nan values from Pandas 2.3.0 using Pydantic 2.11.7
How do I capture missing nan values from Pandas 2.3.0 using Pydantic 2.11.7 Prerequisites: Python 3.11.7 Pandas 2.3.0 Numpy 2.1.3 Pydantic 2.11.7 In the pandas documentation, it states that missing values for numeric data types are filled in with numpy.nan: https://pandas.pydata.org/docs/user_guide/missing_data.html...
https://stackoverflow.com/questions/79756594/how-do-i-capture-missing-nan-values-from-pandas-2-3-0-using-pydantic-2-11-7
python, pandas, numpy, python-typing
1,757,063,273
se_61123068
stackoverflow
DATA_SCIENCE
How to create a new column based on values from other columns in a Pandas DataFrame
How to create a new column based on values from other columns in a Pandas DataFrame I'm new to programming and Pandas. Therefore, please do not judge strictly. To this table, I need to add a new column of values got from other columns. inp = [{'Date':2003, 'b1':5,'b2':0,'b3':4,'b4':3},{'Date':2003, 'b1':2,'b2':2,'b...
https://stackoverflow.com/questions/61123068/how-to-create-a-new-column-based-on-values-from-other-columns-in-a-pandas-datafr
python, python-3.x, pandas
1,586,441,225
se_61090483
stackoverflow
DATA_SCIENCE
Pandas - apply multiplication factor to column values
Pandas - apply multiplication factor to column values I have I dataframe: cases_df = pd.DataFrame(list(cases.items()), columns=['day', 'cases']) where case.items() is structured like so: ([('2020-04-04T00:00:00Z', 10360), ('2020-04-05T00:00:00Z', 11130), ('2020-04- 06T00:00:00Z', 12161)]) how ...
https://stackoverflow.com/questions/61090483/pandas-apply-multiplication-factor-to-column-values
python, pandas
1,586,298,883
se_52728506
stackoverflow
DATA_SCIENCE
Update a dataframe by dataframes with NaN values
Update a dataframe by dataframes with NaN values I try to update a DataFrame df1 = pd.DataFrame(data = {'A' : [1,2,3,4], 'B' : [5,6,7,8]}) by another DataFrame df2 = pd.DataFrame(data = {'B' : [9, np.nan, 11, np.nan]}). Now, my aim is to update df1 by df2 and overwrite all values (NaN values too) using df1.upd...
https://stackoverflow.com/questions/52728506/update-a-dataframe-by-dataframes-with-nan-values
python, pandas, dataframe, updates
1,539,115,332
se_78470913
stackoverflow
DATA_SCIENCE
Generate new Column in Dataframe with Modulo of other Column
Generate new Column in Dataframe with Modulo of other Column I would like to create a new column "Day2" which takes the second digit of column named "Days", so if we have Days equal to 35, we would take the number 5 to be in "Day2", I tried this but it's not working: DF["Day2"] = DF["Days"].where( DF["Days...
https://stackoverflow.com/questions/78470913/generate-new-column-in-dataframe-with-modulo-of-other-column
python, pandas, dataframe, modulo
1,715,588,243
se_64435497
stackoverflow
DATA_SCIENCE
How to properly insert pandas NaT datetime values to my postgresql table
How to properly insert pandas NaT datetime values to my postgresql table I am tying to bulk insert a dataframe to my postgres dB. Some columns in my dataframe are date types with NaT as a null value. Which is not supported by PostgreSQL, I've tried to replace NaT (using pandas) with other NULL type identifies but that...
https://stackoverflow.com/questions/64435497/how-to-properly-insert-pandas-nat-datetime-values-to-my-postgresql-table
python, pandas, postgresql, sqlalchemy, psycopg2
1,603,144,031
se_79756094
stackoverflow
DATA_SCIENCE
Illegal instruction when importing pandas along with wxpython (python 3, Windows)
Illegal instruction when importing pandas along with wxpython (python 3, Windows) Trying to upgrade my python 2.7 scripts to the latest python 3.x for my PC running Windows 7-x64. To do so, I installed python 3.8.9. I get a nasty error when I press ENTER after typing "import pandas" in a script that also import wxpyth...
https://stackoverflow.com/questions/79756094/illegal-instruction-when-importing-pandas-along-with-wxpython-python-3-windows
python-3.x, pandas, numpy, wxpython, windows-7-x64
1,757,010,425
se_54776916
stackoverflow
DATA_SCIENCE
Inverse of Pandas json_normalize
Inverse of Pandas json_normalize I just discovered the json_normalize function which works great in taking a JSON object and giving me a pandas Dataframe. Now I want the reverse operation which takes that same Dataframe and gives me a json (or json-like dictionary which I can easily turn to json) with the same structu...
https://stackoverflow.com/questions/54776916/inverse-of-pandas-json-normalize
json, python-3.x, pandas, normalize
1,550,621,967
se_70142979
stackoverflow
DATA_SCIENCE
fixed rate mortgage in Python
fixed rate mortgage in Python I'm relatively new to coding. I have a task where I have to program an fixed rate mortgage calculator in python. I started by coding this: import pandas as pd import numpy_financial as npf from datetime import date interest = 0.025 years = 10 payments_year = 12 mortgage = 1500000 start_d...
https://stackoverflow.com/questions/70142979/fixed-rate-mortgage-in-python
python, pandas, numpy, datetime
1,638,099,198
se_40923820
stackoverflow
DATA_SCIENCE
Pandas Timedelta in months
Pandas Timedelta in months How can I calculate the elapsed months using pandas? I have write the following, but this code is not elegant. Could you tell me a better way? import pandas as pd df = pd.DataFrame([pd.Timestamp('20161011'), pd.Timestamp('20161101') ], columns=['date']) df['today'] = pd....
https://stackoverflow.com/questions/40923820/pandas-timedelta-in-months
python, pandas
1,480,646,123
se_73325028
stackoverflow
DATA_SCIENCE
How can I create a heatmap with an uneven mesh size from a pandas dataset?
How can I create a heatmap with an uneven mesh size from a pandas dataset? I want to create a plot that looks something like this which maps values to a user-defined mesh size to represent a physical geometry. I was looking for a way to create heat maps and saw that seaborn has a function that creates heat maps. The ...
https://stackoverflow.com/questions/73325028/how-can-i-create-a-heatmap-with-an-uneven-mesh-size-from-a-pandas-dataset
python, pandas, numpy, seaborn, heatmap
1,660,240,796
se_79754631
stackoverflow
DATA_SCIENCE
ModuleNotFoundError: No module named 'pandas' on Raspberry Pi even after installing from requirements.txt
ModuleNotFoundError: No module named 'pandas' on Raspberry Pi even after installing from requirements.txt I’m running a Python project on a Raspberry Pi (Debian / Raspberry Pi OS, Python 3.9.2). The project has its own virtual environment (.venv), and I launch it with a script (alsv4) that starts multiple serv...
https://stackoverflow.com/questions/79754631/modulenotfounderror-no-module-named-pandas-on-raspberry-pi-even-after-install
python, pandas, raspberry-pi4
1,756,905,002
se_63869177
stackoverflow
DATA_SCIENCE
Fetch Bitcoin Data Information through Pandas DataReader
Fetch Bitcoin Data Information through Pandas DataReader I am wanting to ask if Pandas DataReader may be used to extract Bitcoin information from blockchain.com ? I am aware we may use it together with Alpha Vantage API Key to extract stocks through: import pandas as pd import pandas_datareader as dr reader = dr.DataR...
https://stackoverflow.com/questions/63869177/fetch-bitcoin-data-information-through-pandas-datareader
python, pandas, bitcoin, alpha-vantage
1,599,989,360
se_40914399
stackoverflow
DATA_SCIENCE
Pasting data into a pandas dataframe from clipboard
Pasting data into a pandas dataframe from clipboard This is the same question as this question, which is marked as a duplicate of this one. The problem, and the reason I'm still asking, is that the solution provided (using pandas.read_clipboard()) currently doesn't work. I use Python 3.5 and whenever I try to copy dat...
https://stackoverflow.com/questions/40914399/pasting-data-into-a-pandas-dataframe-from-clipboard
python, pandas
1,480,605,899
se_35235010
stackoverflow
DATA_SCIENCE
what is the optimal chunksize in pandas read_csv to maximize speed?
what is the optimal chunksize in pandas read_csv to maximize speed? I am using a 20GB (compressed) .csv file and I load a couple of columns from it using pandas pd.read_csv() with a chunksize=10,000 parameter. However, this parameter is completely arbitrary and I wonder whether a simple formula could give me better c...
https://stackoverflow.com/questions/35235010/what-is-the-optimal-chunksize-in-pandas-read-csv-to-maximize-speed
python, pandas, memory, io, chunks
1,454,713,296
se_44287445
stackoverflow
DATA_SCIENCE
pandas or python equivalent of tidyr complete
pandas or python equivalent of tidyr complete I have data that looks like this: library("tidyverse") df <- tibble(user = c(1, 1, 2, 3, 3, 3), x = c("a", "b", "a", "a", "c", "d"), y = 1) df # user x y # 1 1 a 1 # 2 1 b 1 # 3 2 a 1 # 4 3 a 1 # 5 3 c ...
https://stackoverflow.com/questions/44287445/pandas-or-python-equivalent-of-tidyr-complete
python, pandas
1,496,240,789
se_75173423
stackoverflow
DATA_SCIENCE
Convert excel file (.xlsx) to json
Convert excel file (.xlsx) to json I have a xlsx file Country name Country code IN India SL Sri Lanka I want to convert this to a json in the format json = { {"Name":"India", "Code":"IN"}, {"Name":"Sri Lanka", "Code":"SL"} } I tried load the excel file using the pan...
https://stackoverflow.com/questions/75173423/convert-excel-file-xlsx-to-json
python, json, pandas
1,674,136,886
se_66941446
stackoverflow
DATA_SCIENCE
Reading CSV dates with pandas returns datetime instead of Timestamp
Reading CSV dates with pandas returns datetime instead of Timestamp Problem description: I'm trying to read historical stock prices from CSV format into pandas Dataframe, but one funny thing I have noticed so far - when reading certain row numbers, the dates column type is changed from pandas.Timestamp into datetime -...
https://stackoverflow.com/questions/66941446/reading-csv-dates-with-pandas-returns-datetime-instead-of-timestamp
python, pandas, csv, date, timestamp
1,617,540,434
se_78079837
stackoverflow
DATA_SCIENCE
Check maximum date and keep that row only
Check maximum date and keep that row only I have a df with several duplicated values in column B. What I need is to look for the most recent date of column A for each value in column B and relove the lines that are not the most recent: A B E 26/12/2023 apple 7,9 26/12/2022 apple 8...
https://stackoverflow.com/questions/78079837/check-maximum-date-and-keep-that-row-only
python, pandas, date
1,709,194,841
se_50010257
stackoverflow
DATA_SCIENCE
How to read only non-adjacent columns copied from Excel into a pandas DF via clipboard?
How to read only non-adjacent columns copied from Excel into a pandas DF via clipboard? I love using pd.read_clipboard() to quickly import tabular data from Excel into a DataFrame in pandas. However, if I have highlighted non-adjacent columns in Excel before I hit CTRL+C to copy them to the clipboard, what gets imp...
https://stackoverflow.com/questions/50010257/how-to-read-only-non-adjacent-columns-copied-from-excel-into-a-pandas-df-via-cli
python, excel, pandas
1,524,601,657
se_63572036
stackoverflow
DATA_SCIENCE
Write output in xlsb file format (Excel binary file format) using pandas and pyxlsb
Write output in xlsb file format (Excel binary file format) using pandas and pyxlsb I've read a lot of stackoverflow and other threads where it's been mentioned how to read excel binary file. Reference: Read XLSB File in Pandas Python import pandas as pd df = pd.read_excel('path_to_file.xlsb', engine='pyxlsb') Howeve...
https://stackoverflow.com/questions/63572036/write-output-in-xlsb-file-format-excel-binary-file-format-using-pandas-and-pyx
python-3.x, pandas, xlsb, pyxlsb
1,598,329,518
se_78388929
stackoverflow
DATA_SCIENCE
Configure Sweetviz to analyze object-type column without forced type conversion?
Configure Sweetviz to analyze object-type column without forced type conversion? Consider the following short dataframe example: df = pd.DataFrame({'column1': [2, 4, 8, 0], 'column2': [2, 0, 0, 0], 'column3': ["test", 2, 1, 8]}) df.dtypes shows that the datatypes of the columns ...
https://stackoverflow.com/questions/78388929/configure-sweetviz-to-analyze-object-type-column-without-forced-type-conversion
python, pandas, dataframe, visualization
1,714,117,183
se_60079001
stackoverflow
DATA_SCIENCE
Writing to Excel Sheet using Pandas
Writing to Excel Sheet using Pandas I am trying to update values in an excel sheet using Pandas but the changes overwrites the whole file instead of just a value in in a sheet. sheet_1 = pd.read_excel(r"Documents\TestPage.xlsx", 0) sheet_1.loc[0, 'Test1'] = 10 sheet_1.to_excel("Document...
https://stackoverflow.com/questions/60079001/writing-to-excel-sheet-using-pandas
python, excel, pandas
1,580,916,210
se_78100258
stackoverflow
DATA_SCIENCE
as_index=False groupBy doesn&#39;t work with count
as_index=False groupBy doesn&#39;t work with count When I run groupby on a dataframe with as_index set to False, count seems to not work at all. For example, import pandas as pd word_list = ['a', 'b', 'c', 'a', 'c', 'c', 'b', 'a', 'c'] df = pd.DataFrame(word_list, columns=['word']) as_counts = df.groupby('word', as_...
https://stackoverflow.com/questions/78100258/as-index-false-groupby-doesnt-work-with-count
python, pandas, dataframe, group-by
1,709,545,148
se_79751371
stackoverflow
DATA_SCIENCE
Sorting a column of max values from a multicolumn pandas data frame
Sorting a column of max values from a multicolumn pandas data frame I have a multi-column pandas data frame of years and corresponding cumulative rainfall values from 1 to 183 (October to March). That means in each column the last value is the maximum column value, being the cumulative total from 1. I then create a ne...
https://stackoverflow.com/questions/79751371/sorting-a-column-of-max-values-from-a-multicolumn-pandas-data-frame
python, pandas, dataframe
1,756,581,369
se_65530214
stackoverflow
DATA_SCIENCE
How to set fontsize for title in pandas.DataFrame.plot()?
How to set fontsize for title in pandas.DataFrame.plot()? import pandas as pd import numpy as np df = pd.DataFrame(np.random.rand(3,3), columns=['A','B','C']) df['Name'] = ['Lily','Mary','Joan'] df.plot(x='Name', kind='barh', stacked=True, mark_right=True, figsize=(10,6), title='Distribution of Tags across Pa...
https://stackoverflow.com/questions/65530214/how-to-set-fontsize-for-title-in-pandas-dataframe-plot
python, pandas, dataframe, plot, bar-chart
1,609,509,107
se_79751873
stackoverflow
DATA_SCIENCE
Combine separate plots into one plot in Python
Combine separate plots into one plot in Python I have created the following pandas dataframe: ds = { 'Date' : ['2025-08-22 16:00:00', '2025-08-22 16:01:00', '2025-08-22 16:02:00', '2025-08-22 16:03:00', '2025-08-22 16:04:00', '2025-08-22 16:05:00', '2025-08-22 16:06:00', '2025-08-22 16:07:00', '2025-08-2...
https://stackoverflow.com/questions/79751873/combine-separate-plots-into-one-plot-in-python
python, pandas, dataframe, matplotlib, combinedchart
1,756,655,848
se_68507570
stackoverflow
DATA_SCIENCE
Import &quot;pandas&quot; could not be resolved from sourcePylancereportMissingModuleSource
Import &quot;pandas&quot; could not be resolved from sourcePylancereportMissingModuleSource I've already tried many tutorials on installing pandas. It actually worked the first time I used it, but the second time in a separate file, it doesn't work. I've also already installed pandas through pip installer, and have un...
https://stackoverflow.com/questions/68507570/import-pandas-could-not-be-resolved-from-sourcepylancereportmissingmodulesourc
python, pandas, import, module, pip
1,627,108,141
se_79751965
stackoverflow
DATA_SCIENCE
Can a DataFrame have multiple, different types in the same column?
Can a DataFrame have multiple, different types in the same column? I have a DataFrame, as shown below. In order to build it, I started with adding the numbers (100 for spec A Sum in 2020 and so on). Additionally I add the median as a date. 2020 2021 ... 2024 2025 spec A Sum ...
https://stackoverflow.com/questions/79751965/can-a-dataframe-have-multiple-different-types-in-the-same-column
python, pandas, dataframe, dtype
1,756,668,143
se_31076097
stackoverflow
DATA_SCIENCE
Python pandas: Compare rows of dataframe based on some columns and drop row with lowest value
Python pandas: Compare rows of dataframe based on some columns and drop row with lowest value I have a data frame df: first_seen last_seen uri 0 2015-05-11 23:08:46 2015-05-11 23:08:50 http://11i-ssaintandder.com/ 1 2015-05-11 23:08:46 2015-05-11 23:08:46 http://11i-ssaintan...
https://stackoverflow.com/questions/31076097/python-pandas-compare-rows-of-dataframe-based-on-some-columns-and-drop-row-with
python, pandas, dataframe, compare, row
1,435,329,914
se_79751147
stackoverflow
DATA_SCIENCE
How can I recreate ewm(adjust=False).std() in Pandas?
How can I recreate ewm(adjust=False).std() in Pandas? This recreates ewm(adjust=True).std(): pandas ewm var and std, but I have no luck replicating the calculations in ewm(adjust=False).std(). Replicating ewm(False).mean() is easy but how is the bias corrected when the calculation for variance is recursive? From panda...
https://stackoverflow.com/questions/79751147/how-can-i-recreate-ewmadjust-false-std-in-pandas
python, pandas, standard-deviation, exponential-distribution
1,756,557,303
se_79749770
stackoverflow
DATA_SCIENCE
Pandas read_csv: Skip rows contains invalid data that can cause data_type parsing errors
Pandas read_csv: Skip rows contains invalid data that can cause data_type parsing errors The csv file can contain string values to certain integer columns and I want to ignore/handle via callback if that happens, tried using on_bad_lines='skip/warn' however it gets triggered only on wherever there are parsing issues ...
https://stackoverflow.com/questions/79749770/pandas-read-csv-skip-rows-contains-invalid-data-that-can-cause-data-type-parsin
python, pandas
1,756,434,459
se_79749829
stackoverflow
DATA_SCIENCE
How to do linear interpolation in PySpark without Pandas UDF (only using Spark API)?
How to do linear interpolation in PySpark without Pandas UDF (only using Spark API)? I have a Spark DataFrame with the following structure: shock_rule_id DATE value A 2024-01-01 100 A 2024-01-02 null A 2024-01-03 130 B 2024-01-01 50 B 2024-01-02 null B 2024-01-03 null B 2024-01-04 80 I want to pe...
https://stackoverflow.com/questions/79749829/how-to-do-linear-interpolation-in-pyspark-without-pandas-udf-only-using-spark-a
python, pandas, dataframe, pyspark, interpolation
1,756,443,100
se_65276777
stackoverflow
DATA_SCIENCE
How to extract column labels only from pandas dataframe?
How to extract column labels only from pandas dataframe? I want to extract column labels only which has time format from data frame. My data looks like below and I want to get only data like 06-Dec-2020,07-Dec-2020,08-Dec-2020,09-Dec-2020,10-Dec-2020,11-Dec-2020,12-Dec-2020 Looking for great support
https://stackoverflow.com/questions/65276777/how-to-extract-column-labels-only-from-pandas-dataframe
python, pandas, dataframe
1,607,869,984
se_79749522
stackoverflow
DATA_SCIENCE
Pandas read_csv, load empty/missing column values as NaN while loading empty string for quoted empty strings values in csv file
Pandas read_csv, load empty/missing column values as NaN while loading empty string for quoted empty strings values in csv file My csv file contains empty string "" as well as missing column values ,,. When i am loading with read_csv(), both are loaded as either empty string or NaN depending on keep_default_na and na...
https://stackoverflow.com/questions/79749522/pandas-read-csv-load-empty-missing-column-values-as-nan-while-loading-empty-str
python, pandas, string
1,756,409,642
se_79750354
stackoverflow
DATA_SCIENCE
Pandas merge one-to-many
Pandas merge one-to-many I'm trying to merge two pandas DataFrames on multiple columns. It is a many-to-one relationship. There are many of the same values in df1 but only value in df2. These are the example DataFrames : df1 = pd.DataFrame({'date':['2025-03-01','2025-03-01', '2025-03-02'],'period':[1,1,2], 'company':[...
https://stackoverflow.com/questions/79750354/pandas-merge-one-to-many
python, pandas, join, merge
1,756,474,847
se_75701948
stackoverflow
DATA_SCIENCE
How to merge many data frames to only one
How to merge many data frames to only one I have directory that has many folders inside each folder has (images folder & labels text) and I want to combine them to one dataframe file by concatnating folders name with images name to make them uinque names . The structuer of my directory like below : $ tree . ├── sampl...
https://stackoverflow.com/questions/75701948/how-to-merge-many-data-frames-to-only-one
python, json, pandas, dataframe, deep-learning
1,678,492,427
se_79750041
stackoverflow
DATA_SCIENCE
drop.na code doesn&#39;t show up when using print(data_frame)
drop.na code doesn&#39;t show up when using print(data_frame) I wanna delete missing values from a certain column: #deleting rows with missing values data_excel.dropna(subset=['Budget Betrag']) then I wanna check whether it's working with print(data_excel) But with print(data_excel) the drop.na code doesn't show up....
https://stackoverflow.com/questions/79750041/drop-na-code-doesnt-show-up-when-using-printdata-frame
python, pandas, dataframe
1,756,457,838
se_69703499
stackoverflow
DATA_SCIENCE
Error: module &#39;pandas&#39; has no attribute &#39;read_pdf&#39;
Error: module &#39;pandas&#39; has no attribute &#39;read_pdf&#39; When importing the read_pdf method from pandas using import pandas as pd as the example demonstrated It shows the following error message AttributeError: AttributeError: module 'pandas' has no attribute 'read_pdf' Environment python --version: python ...
https://stackoverflow.com/questions/69703499/error-module-pandas-has-no-attribute-read-pdf
python, python-3.x, pandas, attributeerror
1,635,142,192
se_25830588
stackoverflow
DATA_SCIENCE
R Lattice like plots with Python, Pandas and Matplotlib
R Lattice like plots with Python, Pandas and Matplotlib I have a pandas dataframe of "factors", floats and integers. I would like to make "R Lattice" like plots on it using conditioning and grouping on the categorical variables. I've used R extensively and wrote custom panel functions to get the plots formatted exactl...
https://stackoverflow.com/questions/25830588/r-lattice-like-plots-with-python-pandas-and-matplotlib
python, r, matplotlib, pandas, lattice
1,410,675,053
se_79749580
stackoverflow
DATA_SCIENCE
How to retrieve one data value from the result of a pandas DataFrame.groupby().mean()
How to retrieve one data value from the result of a pandas DataFrame.groupby().mean() Using Pandas 2.3.2 on Python 3.9.2 via JupyterLab. I've collected a bunch of thermal data from a thing. I've already collated that data into DataFrame chunks that look like this: zone data Setpoint 9 zone1 40.3434...
https://stackoverflow.com/questions/79749580/how-to-retrieve-one-data-value-from-the-result-of-a-pandas-dataframe-groupby-m
python, pandas
1,756,413,884
se_79684897
stackoverflow
DATA_SCIENCE
What am i doing wrong appending lists in pandas?
What am i doing wrong appending lists in pandas? I have two csv files in the folder. My output for each loop iteration is avg_mtf. I have been successful in creating lists and concatenating them in the other loops within glob but my comb list is generating only 1 index. What am I doing wrong? Please help. import panda...
https://stackoverflow.com/questions/79684897/what-am-i-doing-wrong-appending-lists-in-pandas
python, pandas, append, glob
1,751,292,583
se_36731231
stackoverflow
DATA_SCIENCE
Combine date and hour into one column in Pandas
Combine date and hour into one column in Pandas How would I combine Day (datetime64[ns]) and Hour (int64) into one datetime column? Day Hour 0 2010-04-24 17 1 2012-08-20 10 2 2016-03-06 9 3 2016-01-02 10 4 2010-12-21 4
https://stackoverflow.com/questions/36731231/combine-date-and-hour-into-one-column-in-pandas
python, datetime, pandas
1,461,108,572
se_63859046
stackoverflow
DATA_SCIENCE
How do I check if a specific item in pandas series is NaT
How do I check if a specific item in pandas series is NaT I have a series of random dates which have some NaT values in it (for example: index 112875) DataFrame['series'] 0 2006-06-06 1 2006-09-06 2 2006-12-22 3 2007-03-09 4 2007-06-05 ... 112871 2019-10-29 112872 ...
https://stackoverflow.com/questions/63859046/how-do-i-check-if-a-specific-item-in-pandas-series-is-nat
python, pandas, series
1,599,904,343
se_79744663
stackoverflow
DATA_SCIENCE
Find max value of a column, then find another value in the same row, and copy that value to a new column
Find max value of a column, then find another value in the same row, and copy that value to a new column I have the following frame: lst = [ ['SPXW 250715C06310000', '7/14/2025', 2.74, 2.87, 2.60, 2.65, 14, '8:30:00'], ['SPXW 250715C06310000', '7/14/2025', 2.80, 2.80, 2.50, 2.53, 61, '8:31:00'], ['SPXW 250...
https://stackoverflow.com/questions/79744663/find-max-value-of-a-column-then-find-another-value-in-the-same-row-and-copy-th
python, pandas, dataframe
1,756,006,491
se_79749078
stackoverflow
DATA_SCIENCE
Brier Skill Score returns NaN in cross_val_score with imbalanced dataset
Brier Skill Score returns NaN in cross_val_score with imbalanced dataset I’m trying to evaluate classification models on a highly imbalanced fraud dataset using the Brier Skill Score (BSS) as the evaluation metric. The dataset has ~2133 rows and the target Fraud_Flag is imbalanced: Counter({0: 2067, 1: 66}) I impl...
https://stackoverflow.com/questions/79749078/brier-skill-score-returns-nan-in-cross-val-score-with-imbalanced-dataset
python, pandas, scikit-learn, imbalanced-data
1,756,383,632