pandas Questions
4
From reading the pandas documentation, and a good question and answer (What does axis in pandas mean?), I had expected axis=0 to always mean with respect to columns. This works for me when I work w...
3
This is a follow up question on applying background color to a dataframe based on condition
I am able to apply style based on the below:
f = lambda v: 'background-color: %s' % 'green' if v=='col' e...
Tillio asked 7/6, 2021 at 9:21
3
Solved
I would like to df.drop_duplicates() based off a subset, but also ignore if a column has a specific value.
For example...
v1 v2 v3
ID
148 8751704.0 G dog
123 9082007.0 G dog
123 9082007.0 G...
2
Solved
I have a data frame for example
df = pd.DataFrame([(np.nan, .32), (.01, np.nan), (np.nan, np.nan), (.21, .18)],
columns=['A', 'B'])
A B
0 NaN 0.32
1 0.01 NaN
2 NaN NaN
3 0.21 0.18
And I want to ...
2
I'm developping an API and deploying it on Google Cloud Run.
There is a prestart python script that import pandas and numpy. When I time the imports numpy take about 2 seconds and pandas about 4 se...
Vastitude asked 4/2, 2021 at 14:8
1
Can we in SQL (preferably Postgresql) mimic the pandas function pivot_table?
For example, let's say we have a table with the following 3 columns:
Name Day Value
John Sunday 6
John Monday 3
John...
Euphonious asked 16/11, 2021 at 17:28
4
How to import and read multiple CSV in chunks when we have multiple csv files and total size of all csv is around 20gb?
I don't want to use Spark as i want to use a model in SkLearn so I want the ...
Impedimenta asked 4/3, 2019 at 16:38
3
Solved
If I do a groupby() followed by a rolling() calculation with a multi-level index, one of the levels in the index is repeated - most odd. I am using Pandas 0.18.1
import pandas as pd
df = pd.DataFr...
Morrison asked 8/2, 2017 at 17:28
3
Solved
I get the foll. output from a pandas cut operation:
0 (0, 20]
1 (0, 20]
2 (0, 20]
3 (0, 20]
4 (0, 20]
5 (0, 20]
6 (0, 20]
7 (0, 20]
8 (0, 20]
9 (0, 20]
How can I convert the (0, 20] to 0 - 20?
...
3
I have a dataset which has a DateTime index and I'm using PCA from sklearn to reduce the number of dimensions.
The following question bugs me - will PCA keep the order of the points in my series s...
Tour asked 1/2, 2017 at 13:50
2
Solved
I have got a bug with:
x.field.rolling(window=5,min_periods=1).mean()
where x is a pandas.core.groupby.groupby.DataFrameGroupBy object.
I tried with the solution proposed in this page. So I did t...
Fearfully asked 4/4, 2019 at 13:28
3
Solved
Wanting to do something similar to this, but complete row aggregation even when nulls are present without including them.
import pandas as pd
import numpy as np
df = pd.DataFrame(data= {'Subject'...
3
Solved
Dates wind up in the bottom right corner of a cell, apparently ignoring alignment settings from xlsxwriter. A MWE:
import pandas
df = pandas.DataFrame(
{
"ints": [1, 2, 3]
, 'primes': [2, 3, 5...
Chiquitachirico asked 16/11, 2017 at 8:48
2
Solved
My system
Windows 7, 64 bit
python 3.5.1
The challenge
I've got a pandas dataframe, and I would like to know the maximum value for each row, and append that info as a new column. I would also l...
4
I have some data in an excel file and I read it using pandas read_excel method.
However I want to read the entire data in all columns as strings including the date column.
The problem is that I w...
1
I am getting Future Warning with Pandas 2.2.2 when I try to concatenate DFs with Floating Values and Nones.
But the same won't happen if I use INT instead of FLOAT
import pandas as pd
# Block with...
4
Solved
I have a Dataframe I wish to write a few rows of into a file and logger in Python 2.7. print(dataframe.iloc[0:4]) outputs a nice grid of the column headers and top 4 rows in the dataframe. However ...
5
Solved
I have a Pandas dataframe that has user information and also has a column for their permissions:
UserName Permissions
John Doe 02
John Doe 11
Example 09
Example 08
User3 11
I am trying to creat...
6
Solved
For a dataframe
import pandas as pd
df = pd.DataFrame(
{'group': list("AADABCBCCCD"),
'Values': [1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]})
I am trying to plot a barplot showing percentage of ...
2
I am using pandas to read from gcs buckets and after making the required transformation and want to save it as parquet i got this error No module named fsspec, I solved it by just installing fsspec...
Coulson asked 8/12, 2022 at 14:0
4
Solved
I am using ffmpeg's extract_mvs file to generate some text information. I would use a command like this in the terminal:
/extract_mvs input.mp4 > output.txt
I would like to use this command w...
2
Solved
When I try to import plotly.express I get the error:
ImportError: Plotly express requires pandas to be installed.
The installation notes did not mention having to install anything additional. I ca...
Larrikin asked 30/8, 2020 at 11:22
4
I have a dataframe with 'execution_date' columns containing dates. So there are also >150 columns which are named as dates '01.03.2023', '02.03.2023' etc. The dataframe itself is empty. The data...
3
I have the dataframe:
a b c d
0 nan Y nan nan
1 1.27838e+06 N 3 96
2 nan N 2 nan
3 284633 Y nan 44
I try to change the data which is non zero to interger type to avoid exponential data(1.27838e...
3
Solved
I have a dataframe that has a field called fields which is a list of dicts (all rows have the same format). Here is how the dataframe is structured:
formId fields
123 [{'number': 1, 'label': 'Last...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.