Comments (4)
I do not understand what behavior you desire. Are you saying that you would like to skip over two columns of the dataframe when writing to the worksheet? But also somehow skipping over two columns in the worksheet so that those two columns in the sheet are unaffected by the dataframe cells being written?
from gspread-dataframe.
Just guessing here, but if you only wish to write some column or columns of a dataframe to a worksheet, derive a second dataframe that contains just the column or columns to write; then use parameters for set_as_dataframe
that allow you to offset the column, etc.:
def set_with_dataframe(
worksheet,
dataframe,
row=1,
col=1,
include_index=False,
include_column_header=True,
resize=False,
allow_formulas=True,
string_escaping="default"):
from gspread-dataframe.
My bad. Too little description :)
I'm thinking of a scenario where a dataframe gets appended to a worksheet with some data in it. The action might result in duplicated cols or rows that need to be dropped (impossible to predict which ones though).
Appending can be easily done by passing the option row=last_row_of_sheet_data+1
to the set_with_dataframe
I was wondering if set_with_dataframe
could have an option to remove the duplicated values in case the worksheet already has some data. Similar to what Panda's drop duplicates does.
from gspread-dataframe.
The most successful approach in using the gspread-dataframe
package is:
- Read the contents of a worksheet into a DataFrame.
- Modify the DataFrame as desired. Add data, drop duplicates, remove columns, etc.
- Write the resulting DataFrame to a worksheet, replacing the entire contents of the worksheet.
I expect that this approach will serve your DataFrame writing needs. If you encounter in the future a specific situation where the above approach isn't sufficient, feel free to open another issue.
from gspread-dataframe.
Related Issues (20)
- buggy behavior when dealing with decimals? HOT 5
- Bug: Object of type int64 is not JSON serializable - introduced by Version 3.1.1 HOT 8
- Bug: escaping when allow_formulas = False is not returning any value HOT 1
- set_with_dataframe: TypeError: Object of type 'int64' is not JSON serializable HOT 2
- Sheets API erroneously rejects new rowCount if (new rowCount * old columnCount) > 5000000 (was: Bug in the number of cells of the dataframe HOT 4
- Cannot use gspread's add_row() method before using set_with_dataframe() HOT 8
- Can't import, "No module named gspread.models" HOT 1
- Data gets interpreted even when using dtype=str HOT 1
- ModuleNotFoundError: No module named 'gspread.models' HOT 7
- Write header rows for DataFrames with MultiIndex columns so that Pandas reads them properly HOT 1
- Include formatting options in set_with_dataframe
- Consider offering a reader/writer object based on a given dataframe
- return API response from set_with_dataframe HOT 5
- No module named 'gspread' HOT 2
- Feature Request: Append feature to an existing sheet. HOT 1
- Max Cell Count
- Requests to sheets API cause 400 error is worksheet name is valid cell reference (was: Error using get_as_dataframe) HOT 1
- Newest version gspread not compatible HOT 7
- get_as_dataframe() is reading the whole sheet data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gspread-dataframe.